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

Compatibility Matrix

This table covers all DuckDB releases that have not reached end-of-life, including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.

Platform 1.4.4 1.4.5 1.5.5 1.5.6 2.0.0
Linux AMD64
Linux ARM64
macOS AMD64
macOS ARM64
Windows AMD64
Windows ARM64
WebAssembly

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 typed_value
temp_directory Set the directory to which temporary files are written. VARCHAR GLOBAL [] post.db.tmp
use_query_condition_cache Enable automatic query condition cache build and apply BOOLEAN GLOBAL [] true