Open JakubCzarlinski opened 3 days ago
There's also this in sqlc:
SELECT *
FROM models
WHERE ID > $1
ORDER BY ID
LIMIT $2;
vs this in sqlx, pgx, pgx_pool
sqlxSelectMultiSQL = `SELECT * FROM models WHERE id > 0 LIMIT 100
where sqlc is unfairly doing more work with ordering and multiple query params.
Hi,
The insert query for sqlx, pgx, and pgx_pool is defines as:
where
sqlxInsertSQL
=This is different from the query in
queries.sql
for sqlc:This unfairly causes memory allocations in the sqlc benchmarks. The version of sqlc used is also out of date. Additionally, inside of the sqlc benchmarks, a
db.CreateModelParams
struct is created on each iteration, unlike in the pgx, pgxpool, and sqlx benchmarks.Fixing these issues I get the following results:
The deviation in ns/op might be a result of me watching YouTube, but note the B/op and allocs/op. Not sure where the 1B/op diff is coming from. 1 off errors are difficult.
Will clean up my repo and submit a PR.