2016-12-21 20:04:27 +00:00
|
|
|
#!/usr/bin/env bash
|
2015-03-28 19:58:07 +00:00
|
|
|
|
|
|
|
QUERIES_FILE="queries.sql"
|
|
|
|
TABLE=$1
|
|
|
|
TRIES=3
|
|
|
|
|
|
|
|
cat "$QUERIES_FILE" | sed "s/{table}/${TABLE}/g" | while read query; do
|
2017-04-05 11:52:23 +00:00
|
|
|
sync
|
|
|
|
echo 3 | sudo tee /proc/sys/vm/drop_caches >/dev/null
|
2015-03-28 19:58:07 +00:00
|
|
|
|
2017-04-05 11:52:23 +00:00
|
|
|
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 "],"
|
2015-03-28 19:58:07 +00:00
|
|
|
done
|