A Nix flake for running database benchmarks using go-tpc, supporting both TPC-C and raw SQL benchmarks.
- Nix installed on your system
- A PostgreSQL database to benchmark against
- Copy the
.env
file and update it with your database connection details:
cp .env.example .env
- Edit the
.env
file with your database configuration:
POSTGRES_URL="postgres://user:password@host:5432/dbname"
WAREHOUSES=10 # For TPC-C benchmark
THREADS=8 # Number of concurrent threads
DURATION="300s" # Test duration
SSL_MODE="disable" # SSL mode: "require", "verify-full", "verify-ca", or "disable"
The tool supports two types of benchmarks:
Run the TPC-C benchmark:
nix run .# -- --warehouses
This will:
- Prepare the database with the TPC-C schema
- Load initial data based on the number of warehouses
- Run the benchmark for the specified duration
- Save results to the results file
Run a benchmark with custom SQL queries:
nix run .# -- --rawsql "path/to/queries/*.sql"
The SQL file should contain the queries you want to benchmark. Example queries are provided in queries/test.sql
.
Enter the development shell:
nix develop
This provides:
- Go development tools
- Shellcheck for script linting
- go-tpc command line tool
MIT License - see LICENSE file for details.