Files
datastore/tests/performance/permuted_columns_cache.xml
Amos Bird 16eef62137 Speed up and broaden permuted_columns_cache perf test
- Replace expensive `hex(sipHash128(...))` fills with cheap `toString(number)`
  variants and reduce row count (5M → 2M). The previous fill dominated the
  test runtime and tripped the "too slow" perf-test warning.
- Broaden the PK / skip-index overlap to 5 String columns, each with its own
  `bloom_filter` skip index (plus a `minmax` on the DateTime64 PK column),
  so the benchmark exposes more of the speedup the cache enables.
2026-05-20 22:43:03 +08:00

70 lines
2.4 KiB
XML

<test>
<!-- Stresses the permuted columns cache: 5 String ORDER BY columns,
each with its own `bloom_filter` skip index, plus a `minmax` index
on a DateTime64 column that is also in the primary key.
Without the cache, every primary-key column is permuted twice
(once for the primary index, once for its skip index). With the
cache, each column is permuted only once. The more PK/skip-index
overlap, the bigger the win. -->
<create_query>
CREATE TABLE permute_cache_wide
(
c1 String,
c2 String,
c3 String,
c4 String,
c5 String,
ts DateTime64(6),
payload String,
value UInt64,
INDEX idx_c1 (c1) TYPE bloom_filter,
INDEX idx_c2 (c2) TYPE bloom_filter,
INDEX idx_c3 (c3) TYPE bloom_filter,
INDEX idx_c4 (c4) TYPE bloom_filter,
INDEX idx_c5 (c5) TYPE bloom_filter,
INDEX idx_ts (ts) TYPE minmax
)
ENGINE = MergeTree
ORDER BY (c1, c2, c3, c4, c5, ts)
SETTINGS min_rows_for_wide_part = 0, min_bytes_for_wide_part = 0
</create_query>
<!-- Pre-materialize the source data so the measured query only does
the part-writing work (which is what the cache affects). Use cheap
string generation (`toString(number)`) to keep the fill fast. -->
<create_query>
CREATE TABLE permute_cache_src
(
c1 String,
c2 String,
c3 String,
c4 String,
c5 String,
ts DateTime64(6),
payload String,
value UInt64
)
ENGINE = Memory
</create_query>
<fill_query>
INSERT INTO permute_cache_src SELECT
toString(number % 1000),
toString((number * 17) % 10000),
toString((number * 31) % 100000),
toString((number * 53) % 1000000),
toString(number),
toDateTime64('2024-01-01', 6) + number / 1000000,
toString(number),
number
FROM numbers(2000000)
</fill_query>
<query>INSERT INTO permute_cache_wide SELECT * FROM permute_cache_src</query>
<drop_query>DROP TABLE IF EXISTS permute_cache_wide</drop_query>
<drop_query>DROP TABLE IF EXISTS permute_cache_src</drop_query>
</test>