ClickHouse/benchmark/postgresql/benchmark.sh
2022-07-04 13:37:42 +02:00

24 lines
741 B
Bash
Executable File

#!/bin/bash
sudo apt-get update
sudo apt-get install -y postgresql-common
sudo apt-get install -y postgresql-14
wget --continue 'https://datasets.clickhouse.com/hits_compatible/hits.tsv.gz'
gzip -d hits.tsv.gz
chmod 777 ~ hits.tsv
sudo -u postgres psql -t -c 'CREATE DATABASE test'
sudo -u postgres psql test -t < create.sql
sudo -u postgres psql test -t -c '\timing' -c "\\copy hits FROM 'hits.tsv'"
# COPY 99997497
# Time: 2341543.463 ms (39:01.543)
./run.sh 2>&1 | tee log.txt
sudo du -bcs /var/lib/postgresql/14/main/
cat log.txt | grep -oP 'Time: \d+\.\d+ ms' | sed -r -e 's/Time: ([0-9]+\.[0-9]+) ms/\1/' |
awk '{ if (i % 3 == 0) { printf "[" }; printf $1 / 1000; if (i % 3 != 2) { printf "," } else { print "]," }; ++i; }'