debug-plan-cache-misses
Debug Chalk query plan cache misses
Chalk caches a compiled query plan the first time it plans a query, keyed by a
normalized BatchQuery. A cache miss forces the engine to replan on the
hot path, which is slow. Misses are expected the first time a query shape is
seen; they are a problem when a query that "looks identical" to a previous
one keeps missing — that means some field in the request is varying between
calls.
This skill: (1) finds misses in the logs, and (2) diffs the planned queries to identify exactly which field differs and forces the miss.
What the cache key actually is
The plan cache key wraps the entire normalized BatchQuery. The only
normalization applied is that planner_options are resolved to their
effective values — so leaving an option unset and setting it explicitly to its
default produce the same key and will not cause a spurious miss.