You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should extend observability beyond global cache stats.
ClickHouse exposes:
cache contents via system.query_condition_cache
per-query hits/misses via system.query_log ProfileEvents
trace-level pruning details like granules dropped / marks read
Iceberg's ScanReport is also a good model: it reports planning duration and scanned/skipped manifests/files. For our future Parquet/Iceberg work, the metrics should generalize over:
table -> data_unit -> data_range -> predicate -> bitmask/result.
Proposal:
Keep condition_cache_stats() for global counters:
entry_count, table_count, memory, lookup_hit/miss, build_count, applied_count,
effective_hit_count, invalidation/eviction counters.
Add condition_cache_entries():
one row per cache entry, similar to ClickHouse system.query_condition_cache:
table, predicate_hash, optional predicate_text, memory, cached row groups,
qualifying vectors, total vectors, selectivity, created/last-used timestamps.
Add condition_cache_last_query() and condition_cache_query_history(n):
one row per scan/probe in recent queries:
query_seq, scan_id, table, predicate_hash, status, skip_reason, lookup_hit,
built_inline, build_time_us, applied, row_groups/vectors pruned,
approx rows pruned, uncached pass-through vectors.
Important: distinguish lookup hit from effective hit.
A lookup hit that prunes zero vectors is useful for debugging but should not be
counted as an effective cache benefit.
create a query-local profile object, e.g. shared_ptr
attach it to the scan bind data
set get.function.dynamic_to_string = ConditionCacheDynamicToString
The practical storage place is a custom bind-data type derived from TableScanBindData, because dynamic_to_string only gets bind_data, local_state, and global_state
We should extend observability beyond global cache stats.
ClickHouse exposes:
Iceberg's ScanReport is also a good model: it reports planning duration and scanned/skipped manifests/files. For our future Parquet/Iceberg work, the metrics should generalize over:
table -> data_unit -> data_range -> predicate -> bitmask/result.
Proposal:
Keep condition_cache_stats() for global counters:
entry_count, table_count, memory, lookup_hit/miss, build_count, applied_count,
effective_hit_count, invalidation/eviction counters.
Add condition_cache_entries():
one row per cache entry, similar to ClickHouse system.query_condition_cache:
table, predicate_hash, optional predicate_text, memory, cached row groups,
qualifying vectors, total vectors, selectivity, created/last-used timestamps.
Add condition_cache_last_query() and condition_cache_query_history(n):
one row per scan/probe in recent queries:
query_seq, scan_id, table, predicate_hash, status, skip_reason, lookup_hit,
built_inline, build_time_us, applied, row_groups/vectors pruned,
approx rows pruned, uncached pass-through vectors.
Add EXPLAIN ANALYZE / JSON profiling extra_info for cached scans:
Query Condition Cache: status, predicate_hash, cached_row_groups,
qualifying_vectors, runtime_vectors_pruned, approx_rows_pruned.
Important: distinguish lookup hit from effective hit.
A lookup hit that prunes zero vectors is useful for debugging but should not be
counted as an effective cache benefit.
The practical storage place is a custom bind-data type derived from TableScanBindData, because dynamic_to_string only gets bind_data, local_state, and global_state
Then update that shared object from: