Skip to content

Instantly share code, notes, and snippets.

@jrdi
Created April 12, 2022 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrdi/dc6ee312b5260ad0a4fee673f4d5645e to your computer and use it in GitHub Desktop.
Save jrdi/dc6ee312b5260ad0a4fee673f4d5645e to your computer and use it in GitHub Desktop.
❯ ./21.9.5.16/clickhouse benchmark <<< "SELECT * FROM wide_compact.compact_parts LIMIT 1000" --cumulative --max_threads 1 -i 500
Loaded 1 queries.
Queries executed: 500.
localhost:9000, queries 500, QPS: 223.399, RPS: 1830084.516, MiB/s: 1298.450, result RPS: 223398.989, result MiB/s: 158.483.
0.000% 0.004 sec.
10.000% 0.004 sec.
20.000% 0.004 sec.
30.000% 0.004 sec.
40.000% 0.004 sec.
50.000% 0.004 sec.
60.000% 0.005 sec.
70.000% 0.005 sec.
80.000% 0.005 sec.
90.000% 0.005 sec.
95.000% 0.005 sec.
99.000% 0.005 sec.
99.900% 0.007 sec.
99.990% 0.007 sec.
❯ ./21.9.5.16/clickhouse benchmark <<< "SELECT * FROM wide_compact.wide_parts LIMIT 1000" --cumulative --max_threads 1 -i 500
Loaded 1 queries.
Queries executed: 500.
localhost:9000, queries 500, QPS: 62.517, RPS: 62516.895, MiB/s: 44.351, result RPS: 62516.895, result MiB/s: 44.351.
0.000% 0.012 sec.
10.000% 0.013 sec.
20.000% 0.013 sec.
30.000% 0.014 sec.
40.000% 0.015 sec.
50.000% 0.016 sec.
60.000% 0.017 sec.
70.000% 0.018 sec.
80.000% 0.018 sec.
90.000% 0.020 sec.
95.000% 0.020 sec.
99.000% 0.022 sec.
99.900% 0.029 sec.
99.990% 0.029 sec.
❯ cat wide_compact.sql | ./21.9.5.16/clickhouse client -h clickhouse-01 -mn
---- Compact
┌─partition─┬─name──────┬─part_type─┬─level─┬────rows─┬─size───────┬───modification_time─┐
│ tuple() │ all_1_1_0 │ Compact │ 0 │ 1048545 │ 715.23 MiB │ 2022-02-25 16:06:48 │
│ tuple() │ all_2_2_0 │ Compact │ 0 │ 951455 │ 649.00 MiB │ 2022-02-25 16:06:50 │
└───────────┴───────────┴───────────┴───────┴─────────┴────────────┴─────────────────────┘
---- Wide
┌─partition─┬─name──────┬─part_type─┬─level─┬────rows─┬─size───────┬───modification_time─┐
│ tuple() │ all_1_1_0 │ Wide │ 0 │ 1048545 │ 715.31 MiB │ 2022-02-25 16:06:51 │
│ tuple() │ all_2_2_0 │ Wide │ 0 │ 951455 │ 649.07 MiB │ 2022-02-25 16:06:53 │
└───────────┴───────────┴───────────┴───────┴─────────┴────────────┴─────────────────────┘
❯ ./21.9.5.16/clickhouse benchmark <<< "SELECT c1 FROM wide_compact.compact_parts LIMIT 1000" --cumulative --max_threads 1 -i 500
Loaded 1 queries.
Queries executed: 500.
localhost:9000, queries 500, QPS: 1718.089, RPS: 14074585.683, MiB/s: 53.690, result RPS: 1718089.073, result MiB/s: 6.554.
0.000% 0.000 sec.
10.000% 0.001 sec.
20.000% 0.001 sec.
30.000% 0.001 sec.
40.000% 0.001 sec.
50.000% 0.001 sec.
60.000% 0.001 sec.
70.000% 0.001 sec.
80.000% 0.001 sec.
90.000% 0.001 sec.
95.000% 0.001 sec.
99.000% 0.001 sec.
99.900% 0.003 sec.
99.990% 0.003 sec.
❯ ./21.9.5.16/clickhouse benchmark <<< "SELECT c1 FROM wide_compact.wide_parts LIMIT 1000" --cumulative --max_threads 1 -i 500
Loaded 1 queries.
Queries executed: 500.
localhost:9000, queries 500, QPS: 1519.752, RPS: 1519752.220, MiB/s: 5.797, result RPS: 1519752.220, result MiB/s: 5.797.
0.000% 0.001 sec.
10.000% 0.001 sec.
20.000% 0.001 sec.
30.000% 0.001 sec.
40.000% 0.001 sec.
50.000% 0.001 sec.
60.000% 0.001 sec.
70.000% 0.001 sec.
80.000% 0.001 sec.
90.000% 0.001 sec.
95.000% 0.001 sec.
99.000% 0.001 sec.
99.900% 0.003 sec.
99.990% 0.003 sec.
DROP DATABASE IF EXISTS wide_compact;
CREATE DATABASE wide_compact;
CREATE TABLE wide_compact.compact_parts
ENGINE = MergeTree
ORDER BY (c1, c2)
SETTINGS min_rows_for_wide_part = 1000000000 AS
SELECT *
FROM generateRandom('c1 UInt32, c2 UInt64, s1 String, c3 UInt32, c4 UInt64, s2 String, c5 UInt32, c6 UInt64, s3 String, c7 UInt32, c8 UInt64, s4 String, c9 UInt64 , c10 UInt64 , c11 UInt64 , c12 UInt64 , c13 UInt64 , c14 UInt64 , c15 UInt64 , c16 UInt64 , c17 UInt64 , c18 UInt64 , c19 UInt64 , c20 UInt64 , c21 UInt64 , c22 UInt64 , c23 UInt64 , c24 UInt64 , c25 UInt64 , c26 UInt64 , c27 UInt64 , c28 UInt64 , c29 UInt64 , c30 UInt64 , c31 UInt64 , c32 UInt64 , c33 UInt64 , c34 UInt64 , c35 UInt64 , c36 UInt64 , c37 UInt64 , c38 UInt64 , c39 UInt64 , c40 UInt64 , c41 UInt64 , c42 UInt64 , c43 UInt64 , c44 UInt64 , c45 UInt64 , c46 UInt64 , c47 UInt64 , c48 UInt64 , c49 UInt64 , c50 UInt64 , c51 UInt64 , c52 UInt64 , c53 UInt64 , c54 UInt64 , c55 UInt64 , c56 UInt64 , c57 UInt64 , c58 UInt64 , c59 UInt64 , c60 UInt64 , c61 UInt64 , c62 UInt64 , c63 UInt64 , c64 UInt64 , c65 UInt64 , c66 UInt64 , c67 UInt64 , c68 UInt64 , c69 UInt64 , c70 UInt64 , c71 UInt64 , c72 UInt64 , c73 UInt64 , c74 UInt64 , c75 UInt64 , c76 UInt64 , c77 UInt64 , c78 UInt64 , c79 UInt64 , c80 UInt64 , c81 UInt64 , c82 UInt64 , c83 UInt64', 0, 30, 30)
LIMIT 2000000;
CREATE TABLE wide_compact.wide_parts
ENGINE = MergeTree
ORDER BY (c1, c2) AS
SELECT *
FROM generateRandom('c1 UInt32, c2 UInt64, s1 String, c3 UInt32, c4 UInt64, s2 String, c5 UInt32, c6 UInt64, s3 String, c7 UInt32, c8 UInt64, s4 String, c9 UInt64 , c10 UInt64 , c11 UInt64 , c12 UInt64 , c13 UInt64 , c14 UInt64 , c15 UInt64 , c16 UInt64 , c17 UInt64 , c18 UInt64 , c19 UInt64 , c20 UInt64 , c21 UInt64 , c22 UInt64 , c23 UInt64 , c24 UInt64 , c25 UInt64 , c26 UInt64 , c27 UInt64 , c28 UInt64 , c29 UInt64 , c30 UInt64 , c31 UInt64 , c32 UInt64 , c33 UInt64 , c34 UInt64 , c35 UInt64 , c36 UInt64 , c37 UInt64 , c38 UInt64 , c39 UInt64 , c40 UInt64 , c41 UInt64 , c42 UInt64 , c43 UInt64 , c44 UInt64 , c45 UInt64 , c46 UInt64 , c47 UInt64 , c48 UInt64 , c49 UInt64 , c50 UInt64 , c51 UInt64 , c52 UInt64 , c53 UInt64 , c54 UInt64 , c55 UInt64 , c56 UInt64 , c57 UInt64 , c58 UInt64 , c59 UInt64 , c60 UInt64 , c61 UInt64 , c62 UInt64 , c63 UInt64 , c64 UInt64 , c65 UInt64 , c66 UInt64 , c67 UInt64 , c68 UInt64 , c69 UInt64 , c70 UInt64 , c71 UInt64 , c72 UInt64 , c73 UInt64 , c74 UInt64 , c75 UInt64 , c76 UInt64 , c77 UInt64 , c78 UInt64 , c79 UInt64 , c80 UInt64 , c81 UInt64 , c82 UInt64 , c83 UInt64', 0, 30, 30)
LIMIT 2000000;
SELECT '---- Compact';
SELECT
partition,
name,
part_type,
level,
rows,
formatReadableSize(bytes_on_disk) AS size,
modification_time
FROM system.parts
WHERE (table = 'compact_parts') AND active
ORDER BY
partition ASC,
modification_time ASC
FORMAT PrettyCompact;
SELECT '---- Wide';
SELECT
partition,
name,
part_type,
level,
rows,
formatReadableSize(bytes_on_disk) AS size,
modification_time
FROM system.parts
WHERE (table = 'wide_parts') AND active
ORDER BY
partition ASC,
modification_time ASC
FORMAT PrettyCompact;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment