plc-mirror/benchmark/run.sh

26 lines
706 B
Bash
Raw Normal View History

2024-02-23 12:10:23 +01:00
#!/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"
2024-02-23 12:28:24 +01:00
cat ../db-migration/migrations/20240217_partition.sql \
2024-02-23 12:10:23 +01:00
| docker compose exec -iT postgres psql -U postgres -d bluesky --echo-queries -c '\timing' \
| tee -a "${output}"