2023-01-10 23:09:14 +00:00
|
|
|
-- Tags: no-parallel
|
2023-01-12 20:40:34 +00:00
|
|
|
-- Tag no-parallel: Messes with internal cache
|
2023-01-10 23:09:14 +00:00
|
|
|
|
2023-01-26 22:23:10 +00:00
|
|
|
SET allow_experimental_query_cache = true;
|
2023-01-26 19:22:24 +00:00
|
|
|
|
2023-01-26 22:23:10 +00:00
|
|
|
SYSTEM DROP QUERY CACHE;
|
2023-01-10 23:09:14 +00:00
|
|
|
|
2023-01-26 22:23:10 +00:00
|
|
|
-- Run a silly query with a non-trivial plan and put the result into the query cache QC
|
|
|
|
SELECT 1 + number from system.numbers LIMIT 1 SETTINGS use_query_cache = true;
|
|
|
|
SELECT count(*) FROM system.query_cache;
|
2023-01-10 23:09:14 +00:00
|
|
|
|
2023-01-26 22:23:10 +00:00
|
|
|
-- EXPLAIN PLAN should show the same regardless if the result is calculated or read from the QC
|
2023-01-10 23:09:14 +00:00
|
|
|
EXPLAIN PLAN SELECT 1 + number from system.numbers LIMIT 1;
|
2023-01-26 22:23:10 +00:00
|
|
|
EXPLAIN PLAN SELECT 1 + number from system.numbers LIMIT 1 SETTINGS use_query_cache = true; -- (*)
|
2023-01-10 23:09:14 +00:00
|
|
|
|
2023-01-26 22:23:10 +00:00
|
|
|
-- EXPLAIN PIPELINE should show the same regardless if the result is calculated or read from the QC
|
2023-01-10 23:09:14 +00:00
|
|
|
EXPLAIN PIPELINE SELECT 1 + number from system.numbers LIMIT 1;
|
2023-01-26 22:23:10 +00:00
|
|
|
EXPLAIN PIPELINE SELECT 1 + number from system.numbers LIMIT 1 SETTINGS use_query_cache = true; -- (*)
|
2023-01-10 23:09:14 +00:00
|
|
|
|
2023-01-26 22:23:10 +00:00
|
|
|
-- Statements (*) must not cache their results into the QC
|
|
|
|
SELECT count(*) FROM system.query_cache;
|
2023-01-10 23:09:14 +00:00
|
|
|
|
2023-01-26 22:23:10 +00:00
|
|
|
SYSTEM DROP QUERY CACHE;
|