ClickHouse/tests/queries/0_stateless/02494_query_cache_events.sql
Robert Schulze 325c6bdf3d
Renaming: "Query Result Cache" --> "Query Cache"
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
2023-01-31 09:54:34 +00:00

33 lines
909 B
SQL

-- Tags: no-parallel
-- Tag no-parallel: Messes with internal cache
SET allow_experimental_query_cache = true;
-- Start with empty query cache QC and query log
SYSTEM DROP QUERY CACHE;
DROP TABLE system.query_log SYNC;
-- Run a query with QC on. The first execution is a QC miss.
SELECT '---';
SELECT 1 SETTINGS use_query_cache = true;
SYSTEM FLUSH LOGS;
SELECT ProfileEvents['QueryCacheHits'], ProfileEvents['QueryCacheMisses']
FROM system.query_log
WHERE type = 'QueryFinish'
AND query = 'SELECT 1 SETTINGS use_query_cache = true;';
-- Run previous query again with query cache on
SELECT '---';
SELECT 1 SETTINGS use_query_cache = true;
DROP TABLE system.query_log SYNC;
SYSTEM FLUSH LOGS;
SELECT ProfileEvents['QueryCacheHits'], ProfileEvents['QueryCacheMisses']
FROM system.query_log
WHERE type = 'QueryFinish'
AND query = 'SELECT 1 SETTINGS use_query_cache = true;';
SYSTEM DROP QUERY CACHE;