Skip to main content

Module query_stats

Module query_stats 

Source
Expand description

v6.5.1 — per-distinct-SQL LRU stat collector.

Tracks (exec_count, total_us, max_us, last_seen_us) per unique SQL string. Bounded LRU cap of 1024 entries — when the cap is exceeded the least-recently-recorded entry is evicted. Engine calls record(sql, elapsed_us, now_us) after every successful execute; the virtual table spg_stat_query reads the entries.

Honest scope: SPG’s plan cache (v6.3.0) lives at a different layer — that one is keyed on SQL text too, but its purpose is AST reuse, not observability. The query-stats layer is purely introspection.

Structs§

QueryStat
QueryStats