Files
ClickHouse/tests/performance/text_index_pattern_bypass_cache.xml

50 lines
1.9 KiB
XML

<test>
<settings>
<use_text_index_like_evaluation_by_dictionary_scan>1</use_text_index_like_evaluation_by_dictionary_scan>
<text_index_like_min_pattern_length>1</text_index_like_min_pattern_length>
<text_index_like_max_postings_to_read>5</text_index_like_max_postings_to_read>
<use_skip_indexes>1</use_skip_indexes>
<use_skip_indexes_on_data_read>1</use_skip_indexes_on_data_read>
<query_plan_direct_read_from_text_index>1</query_plan_direct_read_from_text_index>
<use_query_condition_cache>0</use_query_condition_cache>
<max_threads>1</max_threads>
<max_threads_for_indexes>1</max_threads_for_indexes>
</settings>
<!--
Each part has ~25k unique tokens with embedded postings and six frequent tokens that sort last
in the dictionary. A pattern matching every token scans the whole dictionary before the six
frequent tokens exceed text_index_like_max_postings_to_read, so the bailout is expensive and
repeating it dominates the query time, while the fallback scan of the column is cheap.
-->
<create_query>
CREATE TABLE text_index_pattern_bypass_cache
(
part UInt8,
id UInt64,
message String,
INDEX idx(message) TYPE text(tokenizer = splitByNonAlpha)
)
ENGINE = MergeTree
PARTITION BY part
ORDER BY id
</create_query>
<fill_query>
INSERT INTO text_index_pattern_bypass_cache
SELECT
number % 8,
number,
concat(
'q',
arrayStringConcat(arrayMap(i -> char(97 + intDiv(number, toUInt64(pow(26, i))) % 26), range(5))),
if(intDiv(number, 8) % 100 &lt; 6, concat(' qzzzzzz', char(97 + intDiv(number, 8) % 100)), ''))
FROM numbers(200000)
</fill_query>
<query>SELECT count() FROM text_index_pattern_bypass_cache WHERE message LIKE '%q%'</query>
<query>SELECT count() FROM text_index_pattern_bypass_cache WHERE message ILIKE '%Q%'</query>
<drop_query>DROP TABLE text_index_pattern_bypass_cache</drop_query>
</test>