You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sql: fix top-level query stats when "inner" plans are present
Previously, whenever we ran an "inner" plan (via `runPlanInsidePlan`
helper), we ignored the top-level query stats for the "inner" plan. As
a result, reads and writes performed by the inner plan weren't reflected
in the "outer" top-level query stats. This is now fixed by adjusting the
routines, apply joins, and recursive CTEs to propagate their metrics as
ProducerMetadata objects.
Note that for routines the access to the DistSQL infra is rather
difficult, so we plumbed the access via the planner straight into the
DistSQLReceiver, and even though it's ugly, it should work in practice.
The only alternative I see is adding the necessary reference into the
`eval.Context`, but then it gets tricky to actually set that and ensure
the right copy of the eval context is observed by all routines (plus
we'd need to make the copy or restore the original state somehow), so
I chose to not pursue it.
Release note (bug fix): Previously, CockroachDB didn't include reads and
writes performed by routines (user-defined functions and stored
procedures) as well as apply joins into `bytes read`, `rows read`, and
`rows written` statement execution statistics, and this is now fixed.
The bug has been present since before 23.2 version.
0 commit comments