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. 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
Install pgbench
sudo apt install pgbench
Initialize database for benchmarking
pgbench -h localhost -p 5442 -i mydb
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