ClickHouse/benchmark/compatible/mysql/benchmark.sh

30 lines
875 B
Bash
Raw Normal View History

2022-06-26 04:00:07 +00:00
#!/bin/bash
# Install
sudo apt-get update
2022-06-26 22:24:11 +00:00
sudo apt-get install -y mysql-server-8.0
2022-06-26 04:00:07 +00:00
sudo bash -c "echo -e '[mysql]\nlocal-infile=1\n\n[mysqld]\nlocal-infile=1\n' > /etc/mysql/conf.d/local_infile.cnf"
sudo service mysql restart
# Load the data
2022-06-26 21:04:19 +00:00
wget --continue 'https://datasets.clickhouse.com/hits_compatible/hits.tsv.gz'
2022-06-26 04:00:07 +00:00
gzip -d hits.tsv.gz
sudo mysql -e "CREATE DATABASE test"
sudo mysql test < create.sql
time sudo mysql test -e "LOAD DATA LOCAL INFILE 'hits.tsv' INTO TABLE hits"
# 2:37:52 elapsed
2022-06-26 05:31:49 +00:00
./run.sh 2>&1 | tee log.txt
2022-06-26 21:04:19 +00:00
sudo du -bcs /var/lib/mysql
cat log.txt |
grep -P 'rows? in set|^ERROR' |
sed -r -e 's/^ERROR.*$/null/; s/^.*?\((([0-9.]+) min )?([0-9.]+) sec\).*?$/\2 \3/' |
awk '{ if ($2) { print $1 * 60 + $2 } else { print $1 } }' |
awk '{ if (i % 3 == 0) { printf "[" }; printf $1; if (i % 3 != 2) { printf "," } else { print "]," }; ++i; }'