ClickHouse/tests/queries/1_stateful/00183_prewhere_conditions_order.sql
Nikita Taranov 483c2677a0 impl
2024-10-14 21:06:59 +01:00

29 lines
802 B
SQL

SET optimize_move_to_prewhere = 1;
SET enable_multiple_prewhere_read_steps = 1;
SELECT explain
FROM (
EXPLAIN actions=1
SELECT SearchPhrase, MIN(URL), MIN(Title), COUNT(*) AS c, COUNT(DISTINCT UserID)
FROM test.hits
WHERE Title LIKE '%Google%' AND URL NOT LIKE '%.google.%' AND SearchPhrase <> ''
GROUP BY SearchPhrase
ORDER BY c DESC
LIMIT 10
SETTINGS allow_reorder_prewhere_conditions = 0
)
WHERE explain like '%Prewhere filter column%';
SELECT explain
FROM (
EXPLAIN actions=1
SELECT SearchPhrase, MIN(URL), MIN(Title), COUNT(*) AS c, COUNT(DISTINCT UserID)
FROM test.hits
WHERE Title LIKE '%Google%' AND URL NOT LIKE '%.google.%' AND SearchPhrase <> ''
GROUP BY SearchPhrase
ORDER BY c DESC
LIMIT 10
SETTINGS allow_reorder_prewhere_conditions = 1
)
WHERE explain like '%Prewhere filter column%';