Skip to content

Conversation

hazefully
Copy link
Contributor

@hazefully hazefully commented Aug 15, 2025

This PR adds two new columns, PLAN_HASH and SERIALIZED_PLAN_COMPLEXITY, to the PLAN_CONTINUATION struct in the result from EXPLAIN which contain the plan hash stored in the continuation and the complexity of the plan serialized within the continuation (if the continuation contains a compiled statement )respectively .

The new columns are populated for EXPLAINs on an EXECUTE CONTINUATION statement and a regular SELECT statement that uses the WITH CONTINUATION clause.

This commit adds a new column, 'SERIALIZED_PLAN_COMPLEXITY' to the
'PLAN_CONTINUATION' struct in the result from EXPLAIN which contains the complexity
of the plan serialized within the continuation, if the continuation contains a compiled
statement. This new column is populated for EXPLAINs on an 'EXECUTE CONTINUATION' statement
and a regular SELECT statement that uses the `WITH CONTINUATION` clause.
@hazefully hazefully added the enhancement New feature or request label Aug 15, 2025
@hazefully hazefully changed the title Add serialized plan complexity to the continuation info in EXPLAIN Add serialized plan complexity and hash to the continuation info in EXPLAIN Aug 15, 2025
@hazefully hazefully force-pushed the serialized-plan-complexity-in-explain branch from cea95af to 14377d6 Compare August 15, 2025 17:19
@hazefully hazefully marked this pull request as ready for review August 15, 2025 17:20
@hazefully hazefully requested a review from g31pranjal August 22, 2025 15:38
This is unnecessary as there is no way the contiuation being explained
for a ContinuedPhysicalQueryPlan would not match the continuation that
was originally used to create the ContinuedPhysicalQueryPlan in the
first place.
This can only happen with for 'SELECT ... WITH CONTINUATION' queries, it
can't happen with 'EXECUTE CONTINUATION' queries.
This commit asserts that the plan hash in the continuation passed to
ContinuedPhysicalQueryPlan::getSerializedPlanFromContinuation matches
the plan hash of the plan that was extracted from the continuation and
used to construct the ContinuedPhysicalQueryPlan.

In practice, this should always be true unless the code was changed in
an incompatible way so the continuation passed to getSerializedPlanFromContinuation
is not the same continuation that was used to deserialize the physical
plan.
@hazefully hazefully requested a review from g31pranjal August 28, 2025 13:00
@hazefully hazefully force-pushed the serialized-plan-complexity-in-explain branch from b190639 to 274cca7 Compare August 28, 2025 13:02
@hazefully hazefully merged commit 045834e into FoundationDB:main Aug 29, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants