v.24.9New Feature

Query Cache Entries Can Now Be Dropped by Tag in ClickHouse

Query cache entries can now be dropped by tag. For example, the query cache entry created by SELECT 1 SETTINGS use_query_cache = true, query_cache_tag = 'abc' can now be dropped by SYSTEM DROP QUERY CACHE TAG 'abc'. #68477 (Michał Tabaszewski).
Query cache entries in ClickHouse can now be selectively dropped by specifying their associated tags.

Why it matters

This feature allows users to efficiently manage and invalidate cached query results by targeting specific cache entries linked with a tag, improving cache control and cache consistency without flushing the entire query cache.

How to use it

When running a query with query caching enabled, assign a tag using the setting query_cache_tag, for example:

SELECT 1 SETTINGS use_query_cache = true, query_cache_tag = 'abc'


To drop all cached query results associated with a particular tag, use the system command:

SYSTEM DROP QUERY CACHE TAG 'abc'