This benchmark will use Postgres as a test database and pgx as the driver.
Start a PostgreSQL Image:
docker run -d \
--name go-sql-benchmark-pg \
-p 5432:5432 \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=test \
-e POSTGRES_USERNAME=postgres \
postgres:12
Start the test
export BENCHMARK_SQL_DSN="host=localhost user=postgres password=postgres dbname=test sslmode=disable"
# run
go test -v ./... -bench=. -benchmem
Using cob to run benchmark on Github Actions.
Find the reference report at: https://github.com/wayjam/go-sql-benchmark/actions?query=branch%3Amaster+is%3Asuccess
- CI and auto-genereated report
- prepare statement benchmark
- ent benchmark
- add more code comments
- comparison between libs.
Feel free to make contributiton to this project.