2017-12-15 19:34:19 +00:00
|
|
|
#!/usr/bin/env bash
|
2014-04-24 23:13:33 +00:00
|
|
|
|
2017-12-15 19:34:19 +00:00
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
2020-12-28 11:46:53 +00:00
|
|
|
# shellcheck source=../shell_config.sh
|
2020-08-01 00:51:12 +00:00
|
|
|
. "$CURDIR"/../shell_config.sh
|
2017-12-15 19:34:19 +00:00
|
|
|
|
2020-08-01 00:56:32 +00:00
|
|
|
echo 'DROP TABLE IF EXISTS long_insert' | ${CLICKHOUSE_CURL} -sSg "${CLICKHOUSE_URL}" -d @-
|
2023-01-10 16:27:23 +00:00
|
|
|
echo 'CREATE TABLE long_insert (str String) ENGINE = Memory' | ${CLICKHOUSE_CURL} -sSg "${CLICKHOUSE_URL}" -d @-
|
2014-04-24 23:13:33 +00:00
|
|
|
for string_size in 1 10 100 1000 10000 100000 1000000; do
|
2018-01-10 00:04:08 +00:00
|
|
|
# LC_ALL=C is needed because otherwise Perl will bark on bad tuned environment.
|
2019-10-11 13:34:26 +00:00
|
|
|
LC_ALL=C perl -we 'for my $letter ("a" .. "z") { print(($letter x '$string_size') . "\n") }' | ${CLICKHOUSE_CURL} -sSg "${CLICKHOUSE_URL}&query=INSERT+INTO+long_insert+FORMAT+TabSeparated" --data-binary @-
|
2023-01-10 16:27:23 +00:00
|
|
|
echo 'SELECT substring(str, 1, 1) AS c, length(str) AS l FROM long_insert ORDER BY c, l' | ${CLICKHOUSE_CURL} -sSg "${CLICKHOUSE_URL}" -d @-
|
2014-04-24 23:13:33 +00:00
|
|
|
done
|
2020-11-11 15:29:36 +00:00
|
|
|
|
|
|
|
echo 'DROP TABLE long_insert' | ${CLICKHOUSE_CURL} -sSg "${CLICKHOUSE_URL}" -d @-
|