Created
June 29, 2021 10:06
-
-
Save dchimeno/0f2d104e86edb3ddf3a302bfafd2fb17 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
QUERIES_FILE="bench_queries-uk.sql" | |
TABLE=$1 | |
TRIES=3 | |
cat "$QUERIES_FILE" | sed "s/{table}/${TABLE}/g" | while read query; do | |
if [ $query != "--*" ] | |
then | |
echo "query" | |
sync | |
echo 3 | sudo tee /proc/sys/vm/drop_caches >/dev/null | |
echo -n "[" | |
for i in $(seq 1 $TRIES); do | |
RES=$(clickhouse-client --time --format=Null --query="$query" 2>&1) | |
[[ "$?" == "0" ]] && echo -n "${RES}" || echo -n "null" | |
[[ "$i" != $TRIES ]] && echo -n ", " | |
done | |
echo -n "]," | |
else | |
echo "sin entrar" | |
echo $query | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment