Scripts for benchmarking partitioning
parent
78a17bf238
commit
297e9e0347
|
@ -2,4 +2,5 @@ go.work*
|
||||||
.env
|
.env
|
||||||
*.csv
|
*.csv
|
||||||
*.out
|
*.out
|
||||||
|
*.log
|
||||||
csv_export.tgz
|
csv_export.tgz
|
|
@ -0,0 +1 @@
|
||||||
|
../.env
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
docker compose exec -i postgres pg_dump -U postgres -d bluesky -t records -t records_id_seq --schema-only | sed -E -e 's/PARTITION BY.*/;/' > records.sql
|
||||||
|
docker compose exec -i postgres pg_dump -U postgres -d bluesky --table-and-children records --load-via-partition-root --data-only | lz4 > records.sql.lz4
|
|
@ -0,0 +1,14 @@
|
||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: "postgres:16"
|
||||||
|
volumes:
|
||||||
|
- "${DATA_DIR:?specify data dir in .env file}/benchmark:/var/lib/postgresql/data:rw"
|
||||||
|
restart: always
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: bluesky
|
||||||
|
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:?specify password in .env file}"
|
||||||
|
command: ["-c", "max_connections=1000"]
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
output="psql_$(date '+%y%m%d_%H%M%S').log"
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
docker compose stop postgres
|
||||||
|
|
||||||
|
. ./.env
|
||||||
|
sudo rm -rf ${DATA_DIR:?DATA_DIR not set}/benchmark
|
||||||
|
|
||||||
|
echo "$(date): Starting data import..."
|
||||||
|
|
||||||
|
docker compose up -d postgres
|
||||||
|
|
||||||
|
while ! docker compose exec postgres psql -U postgres -d bluesky -c 'select 1;'; do sleep 1; done
|
||||||
|
|
||||||
|
cat ../records.sql | docker compose exec -iT postgres psql -U postgres -d bluesky
|
||||||
|
lz4cat ../records.sql.lz4 | docker compose exec -iT postgres psql -U postgres -d bluesky
|
||||||
|
|
||||||
|
echo "$(date): Data import done"
|
||||||
|
|
||||||
|
cat ../db-migration/20240217_partition.sql \
|
||||||
|
| docker compose exec -iT postgres psql -U postgres -d bluesky --echo-queries -c '\timing' \
|
||||||
|
| tee -a "${output}"
|
Loading…
Reference in New Issue