Skip to content

Instantly share code, notes, and snippets.

@aagontuk
Created February 16, 2021 15:51
Show Gist options
  • Select an option

  • Save aagontuk/46a65cb8ac854b1b8b2d8ca6f4047976 to your computer and use it in GitHub Desktop.

Select an option

Save aagontuk/46a65cb8ac854b1b8b2d8ca6f4047976 to your computer and use it in GitHub Desktop.
BOLT with postgres

Compiling postgres

wget https://ftp.postgresql.org/pub/source/v13.2/postgresql-13.2.tar.gz
tar xzvf postgresql-13.2.tar.gz.tar.gz
cd postgresql-13.2
export LDFLAGS="-Wl,-q"
./configure --prefix=$(pwd)/install

Start server and create a database

Start server. specify a directory with -D flag where postgres will store all data and configs

./install/bin/postgres -p 5442 -D /tmp/postgres

Create a new database:

./install/bin/createdb mydb

Benchmarking

Install pgbench

sudo apt install pgbench

Initialize database for benchmarking

pgbench -h localhost -p 5442 -i mydb

Collecting profile

Stop the server by hitting Ctrl+C. Now start server again with perf:

perf record -e cycles:u -j any,u -o perf.data -- ./install/bin/postgres -p 5442 -D /tmp/postgres

Run benchmark upto your desired time. I am running for 10 mins for profile collection:

pgbench -h localhost -p 5442 -T 600 mydb

After that stop the server. Now do perf2bolt and llvm-bolt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment