cockroachdb / cockroachdb/cockroach
sql: EXPLAIN ANALYZE double counts contention and admission wait from inner plans
Open
A-sql-explain
A-sql-routine
branch-master
C-bug
T-sql-queries
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
For runPlanInsidePlan, we add the inner plan's stats into the statement's EXPLAIN ANALYZE totals. That's needed for most stats (KV bytes, rows, etc.), because those are tagged with a flow ID and the statement-level scan deliberately skips the inner plan's flows.
But **contention events and admission wait time** have no flow ID. So the statement already counted them once, and adding the inner plan's stats counts them again. Nested routines make it worse: each level of nesting adds one more copy.
Jira issue: CRDB-66413
Contributor guide
Assessment
This issue has not been assessed yet.