cockroachdb / cockroachdb/cockroach

sql: EXPLAIN ANALYZE double counts contention and admission wait from inner plans

Open
#173,104 0 comments 0 reactions 1 assignee Claimed by @ZhouXing19 View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.