2021-10-31 12:43:48 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-07-04 11:37:42 +00:00
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y postgresql-common
|
|
|
|
sudo apt-get install -y postgresql-14
|
2021-10-31 12:43:48 +00:00
|
|
|
|
2022-07-04 11:37:42 +00:00
|
|
|
wget --continue 'https://datasets.clickhouse.com/hits_compatible/hits.tsv.gz'
|
|
|
|
gzip -d hits.tsv.gz
|
|
|
|
chmod 777 ~ hits.tsv
|
2021-10-31 12:43:48 +00:00
|
|
|
|
2022-07-04 11:37:42 +00:00
|
|
|
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; }'
|