ClickHouse/tests/queries/1_stateful/00183_prewhere_conditions_order.sql

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
802 B
MySQL
Raw Normal View History

2024-10-14 20:06:59 +00:00
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%';