Search Shortcut cmd + k | ctrl + k
query_condition_cache

This extension provides a cache for query conditions, which is useful for repeated-query workloads like metrics monitoring dashboards, log investigations, etc.

Maintainer(s): Andrewtangtang, peterxcli, dentiny

Installing and Loading

INSTALL query_condition_cache FROM community;
LOAD query_condition_cache;

Example

SELECT * FROM condition_cache_build('t', 'val = 42 AND msg LIKE ''%2''');

About query_condition_cache

This extension enhances DuckDB core capability and improves query performance for repeated-query workloads by caching the query conditions.

Added Functions

function_name function_type description comment examples
__condition_cache_filter scalar Internal optimizer filter that checks whether the cache permits scanning a row ID's vector. NULL [SELECT __condition_cache_filter(0);]
condition_cache_build table Builds or replaces a query condition cache for rows in a table that match a SQL predicate. NULL [SELECT * FROM condition_cache_build('events', 'event_type = ''error''');]
condition_cache_info table Returns row-group and vector coverage for a cached table and SQL predicate, or zeroes when no entry exists. NULL [SELECT * FROM condition_cache_info('events', 'event_type = ''error''');]
condition_cache_reset_stats scalar Resets query condition cache hit and access counters and returns true. NULL [SELECT condition_cache_reset_stats();]
condition_cache_stats table Returns query condition cache memory use, hit count, and access count. NULL [SELECT * FROM condition_cache_stats();]

Overloaded Functions

This extension does not add any function overloads.

Added Types

This extension does not add any types.

Added Settings

name description input_type scope aliases
use_query_condition_cache Enable automatic query condition cache build and apply BOOLEAN GLOBAL []