2023-01-26 22:23:10 +00:00
|
|
|
-- Tags: no-parallel
|
|
|
|
-- Tag no-parallel: Messes with internal cache
|
|
|
|
|
2023-06-13 14:15:30 +00:00
|
|
|
-- Start with empty query cache QC
|
2023-01-26 22:23:10 +00:00
|
|
|
SYSTEM DROP QUERY CACHE;
|
|
|
|
|
|
|
|
-- 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'
|
2023-06-13 14:15:30 +00:00
|
|
|
AND current_database = currentDatabase()
|
2023-01-26 22:23:10 +00:00
|
|
|
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;
|
|
|
|
|
|
|
|
SYSTEM FLUSH LOGS;
|
|
|
|
SELECT ProfileEvents['QueryCacheHits'], ProfileEvents['QueryCacheMisses']
|
|
|
|
FROM system.query_log
|
|
|
|
WHERE type = 'QueryFinish'
|
2023-06-13 14:15:30 +00:00
|
|
|
AND current_database = currentDatabase()
|
|
|
|
AND query = 'SELECT 1 SETTINGS use_query_cache = true;'
|
|
|
|
ORDER BY event_time_microseconds;
|
2023-01-26 22:23:10 +00:00
|
|
|
|
|
|
|
SYSTEM DROP QUERY CACHE;
|