ClickHouse/tests/queries/0_stateless/02494_query_cache_query_log.sql

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

68 lines
1.7 KiB
MySQL
Raw Normal View History

-- Tags: no-parallel
-- Tag no-parallel: Messes with internal cache
SYSTEM DROP QUERY CACHE;
-- DROP TABLE system.query_log; -- debugging
SELECT '-- Run a query with query cache not enabled';
SELECT 124437993;
SYSTEM FLUSH LOGS;
-- Field 'query_cache_usage' should be 'None'
SELECT type, query, query_cache_usage
FROM system.query_log
WHERE current_database = currentDatabase()
AND query = 'SELECT 124437993;'
2023-07-25 12:09:13 +00:00
AND type = 'QueryFinish'
ORDER BY type, query_cache_usage;
SELECT '-- Run a query with query cache enabled';
SELECT 124437994 SETTINGS use_query_cache = 1;
SYSTEM FLUSH LOGS;
-- Field 'query_cache_usage' should be 'Write'
SELECT type, query, query_cache_usage
FROM system.query_log
WHERE current_database = currentDatabase()
AND query = 'SELECT 124437994 SETTINGS use_query_cache = 1;'
2023-07-25 12:09:13 +00:00
AND type = 'QueryFinish'
ORDER BY type, query_cache_usage;
SELECT '-- Run the same query with query cache enabled';
SELECT 124437994 SETTINGS use_query_cache = 1;
SYSTEM FLUSH LOGS;
-- Field 'query_cache_usage' should be 'Read'
SELECT type, query, query_cache_usage
FROM system.query_log
WHERE current_database = currentDatabase()
AND query = 'SELECT 124437994 SETTINGS use_query_cache = 1;'
2023-07-25 12:09:13 +00:00
AND type = 'QueryFinish'
ORDER BY type, query_cache_usage;
SELECT '-- Throw exception with query cache enabled';
SELECT 124437995, throwIf(1) SETTINGS use_query_cache = 1; -- { serverError FUNCTION_THROW_IF_VALUE_IS_NON_ZERO }
SYSTEM FLUSH LOGS;
-- Field 'query_cache_usage' should be 'None'
SELECT query, query_cache_usage
FROM system.query_log
WHERE current_database = currentDatabase()
AND query = 'SELECT 124437995, throwIf(1) SETTINGS use_query_cache = 1;'
AND type = 'ExceptionWhileProcessing';
SYSTEM DROP QUERY CACHE;