Skip to content

Instantly share code, notes, and snippets.

@detj
Last active October 24, 2024 10:20
Show Gist options
  • Save detj/830e2d6d2415f7b49af3dad740e32981 to your computer and use it in GitHub Desktop.
Save detj/830e2d6d2415f7b49af3dad740e32981 to your computer and use it in GitHub Desktop.
ClickHouse Management Queries
--------------
-- query cache
--------------
-- see full details of query cache entries
SELECT
substring(query, 1, 30),
result_size,
tag,
stale,
shared,
compressed,
expires_at,
key_hash
FROM system.query_cache
ORDER BY expires_at DESC
-- see details of query cache usage from query log
SELECT
substring(query, 1, 40),
query_cache_usage,
query_start_time,
query_duration_ms
FROM system.query_log
WHERE query_cache_usage IN ('Write', 'Read')
ORDER BY
query_start_time DESC,
query_duration_ms DESC
LIMIT 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment