Files
ClickHouse/tests/performance/hashing_serialized_values.xml
Groene AIandClaude Opus 5.5 cc3bb2aa17 Hash pre-built JSON values in the hashing_serialized_values performance test
Query #1 cast a String to JSON inside the measured query, so most of its
CPU (about 80% in the arm CI profile, 72% on x86 locally) went to the
JSON parser rather than to the serializing hash the test exists for. The
parse has a per-server-process slow mode, so a slow draw on the tested
server read as a hashing regression and turned unrelated PRs red
(Performance Comparison on #117318: +15.8%, gone after a server restart).

Build the JSON column once at fill time in a Memory table and hash the
stored column, single-threaded as before and as in query #2. JSON parsing
itself stays measured by new_json_type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 19:52:29 +00:00

16 lines
1.0 KiB
XML

<test>
<create_query>CREATE TABLE states (st AggregateFunction(groupArray, String)) ENGINE = Memory</create_query>
<create_query>CREATE TABLE json_values (j JSON) ENGINE = Memory</create_query>
<fill_query>INSERT INTO states SELECT groupArrayState(repeat('q', 200)) FROM numbers(2000000) GROUP BY number</fill_query>
<fill_query>INSERT INTO json_values SELECT concat('{{"a":', number::String, '}}')::JSON FROM numbers_mt(4000000)</fill_query>
<!-- Types with no contiguous in-memory representation are hashed by serializing every row. -->
<query>SELECT count() FROM numbers(20000000) WHERE NOT ignore(xxHash64(number::Variant(UInt64, String)))</query>
<query>SELECT count() FROM json_values WHERE NOT ignore(sipHash64(j)) SETTINGS max_threads = 1</query>
<!-- Aggregate states are hashed by serializing each state. -->
<query>SELECT uniqExact(st) FROM states SETTINGS max_threads = 1</query>
<drop_query>DROP TABLE IF EXISTS states</drop_query>
<drop_query>DROP TABLE IF EXISTS json_values</drop_query>
</test>