mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-06 14:32:22 +00:00
325c6bdf3d
Reasons: - The cache will at some point store intermediate results as opposed to only query results. We should change the terminology now without having to worry about backward compat. - Equivalent caches in MySQL (1) and Starrocks (2) are called "query cache". - The new name is ca. 13.8% more catchy. (1) https://dev.mysql.com/doc/refman/5.6/en/query-cache.html (2) https://docs.starrocks.io/en-us/2.5/using_starrocks/query_cache
69 lines
2.1 KiB
SQL
69 lines
2.1 KiB
SQL
-- Tags: no-parallel
|
|
-- Tag no-parallel: Messes with internal cache
|
|
|
|
SET allow_experimental_query_cache = true;
|
|
|
|
SYSTEM DROP QUERY CACHE;
|
|
DROP TABLE IF EXISTS eligible_test;
|
|
DROP TABLE IF EXISTS eligible_test2;
|
|
|
|
-- enable query cache session-wide but also force it individually in each of below statements
|
|
SET use_query_cache = true;
|
|
|
|
-- check that SELECT statements create entries in the query cache ...
|
|
SELECT 1 SETTINGS use_query_cache = true;
|
|
SELECT COUNT(*) FROM system.query_cache;
|
|
|
|
SYSTEM DROP QUERY CACHE;
|
|
|
|
-- ... and all other statements also should not create entries:
|
|
|
|
-- CREATE
|
|
CREATE TABLE eligible_test (a String) ENGINE=MergeTree ORDER BY a; -- SETTINGS use_query_cache = true; -- SETTINGS rejected as unknown
|
|
SELECT COUNT(*) FROM system.query_cache;
|
|
|
|
-- ALTER
|
|
ALTER TABLE eligible_test ADD COLUMN b String SETTINGS use_query_cache = true;
|
|
SELECT COUNT(*) FROM system.query_cache;
|
|
|
|
-- INSERT
|
|
INSERT INTO eligible_test VALUES('a', 'b'); -- SETTINGS use_query_cache = true; -- SETTINGS rejected as unknown
|
|
SELECT COUNT(*) FROM system.query_cache;
|
|
INSERT INTO eligible_test SELECT * FROM eligible_test SETTINGS use_query_cache = true;
|
|
SELECT COUNT(*) FROM system.query_cache;
|
|
|
|
-- SHOW
|
|
SHOW TABLES SETTINGS use_query_cache = true;
|
|
SELECT COUNT(*) FROM system.query_cache;
|
|
|
|
-- CHECK
|
|
CHECK TABLE eligible_test SETTINGS use_query_cache = true;
|
|
SELECT COUNT(*) FROM system.query_cache;
|
|
|
|
-- DESCRIBE
|
|
DESCRIBE TABLE eligible_test SETTINGS use_query_cache = true;
|
|
SELECT COUNT(*) FROM system.query_cache;
|
|
|
|
-- EXISTS
|
|
EXISTS TABLE eligible_test SETTINGS use_query_cache = true;
|
|
SELECT COUNT(*) FROM system.query_cache;
|
|
|
|
-- KILL
|
|
KILL QUERY WHERE query_id='3-857d-4a57-9ee0-3c7da5d60a90' SETTINGS use_query_cache = true;
|
|
SELECT COUNT(*) FROM system.query_cache;
|
|
|
|
-- OPTIMIZE
|
|
OPTIMIZE TABLE eligible_test FINAL SETTINGS use_query_cache = true;
|
|
SELECT COUNT(*) FROM system.query_cache;
|
|
|
|
-- TRUNCATE
|
|
TRUNCATE TABLE eligible_test SETTINGS use_query_cache = true;
|
|
SELECT COUNT(*) FROM system.query_cache;
|
|
|
|
-- RENAME
|
|
RENAME TABLE eligible_test TO eligible_test2 SETTINGS use_query_cache = true;
|
|
SELECT COUNT(*) FROM system.query_cache;
|
|
|
|
SYSTEM DROP QUERY CACHE;
|
|
DROP TABLE eligible_test2;
|