Open Azhng opened 3 years ago
2 possible solutions: 1) make DEALLOCATE similar to PREPARE, meaning making DEALLOCATE do not appear in the statement stats 2) change PREPARE so that stats are collected
cc @kevin-v-ngo
Leaving my current findings here. I'm happy to review this or work on it if that would help.
PREPARE doesn't show up in the stats because it is special-cased and returns early here: https://github.com/cockroachdb/cockroach/blob/0254918dfbe7ebc8a624562a8f7d3a9342b2b178/pkg/sql/conn_executor_exec.go#L533-L579
If desired, DEALLOCATE could probably be handled there too, instead of making it a function on planner
:
https://github.com/cockroachdb/cockroach/blob/0254918dfbe7ebc8a624562a8f7d3a9342b2b178/pkg/sql/deallocate.go#L23-L32
We have marked this issue as stale because it has been inactive for 18 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to CockroachDB!
See #69375 for discussion.
Summary: we collects stats for
DEALLOCATE
but not forPREPARE
statements. This isPREPARE
has its own short circuit execution path inconnExecutor
that preventssqlstats
from collecting its statistics. As the result, Statement Page would show a lot ofDEALLOCATE
statements without correspondingPREPARE
statements.If
DEALLOCATE
is removed from the stats, then perhaps there should be metrics on it (andPREPARE
) like these ones: https://github.com/cockroachdb/cockroach/blob/56afa9f4afb8211ef7783b7069cded1e1a880bed/pkg/sql/exec_util.go#L741Jira issue: CRDB-9621
Epic CRDB-32139