cockroach icon indicating copy to clipboard operation
cockroach copied to clipboard

opt: introduce memo.ExistsPrivate and add lazy projection column

Open mgartner opened this issue 1 year ago • 4 comments

opt: introduce memo.ExistsPrivate and add lazy projection column

This commit introduces the memo.ExistsPrivate struct, which wraps the memo.SubqueryPrivate struct. This new private struct has a column that is used during the execbuilder phase if the Exists subquery is planned as a lazily-evaluated routine. By adding this column to the Exists expression, we can avoid the anti-pattern of creating a new column ID in the execbuilder. This will be beneficial in future commits in which execbuilder will rely on knowing the maximum column ID for a query plan before it begins constructing execution nodes.

Release note: None

opt: move WasLimited from SubqueryPrivate to ExistsPrivate

The WasLimited field is only used for Exists subqueries, so it has been moved from SubqueryPrivate to ExistsPrivate.

Release note: None

opt: remove IntroduceExistsLimit rule

This rule has been superseded by the ConvertUncorrelatedExistsToCoalesceSubquery rule. Since that rule was introduced, IntroduceExistsLimit should have never matched.

Release note: None

mgartner avatar Feb 12 '24 19:02 mgartner

Your pull request contains more than 1000 changes. It is strongly encouraged to split big PRs into smaller chunks.

:owl: Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

blathers-crl[bot] avatar Feb 12 '24 19:02 blathers-crl[bot]

This change is Reviewable

cockroach-teamcity avatar Feb 12 '24 19:02 cockroach-teamcity

This change is a prerequisite for the changes in #119095.

mgartner avatar Feb 12 '24 19:02 mgartner

The diff is quite large, but most of it is changes to column IDs in optimizer tests. I'm happy to walk through all the changes if that'd be helpful.

mgartner avatar Feb 12 '24 20:02 mgartner

TFTR!

bors r+

mgartner avatar Feb 24 '24 20:02 mgartner

Build succeeded:

craig[bot] avatar Feb 24 '24 20:02 craig[bot]