Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opt: add rule to eliminate Exists when input has zero rows #48162

Merged
merged 1 commit into from
Apr 29, 2020

Conversation

rytaft
Copy link
Collaborator

@rytaft rytaft commented Apr 29, 2020

This commit adds a new rule, EliminateExistsZeroRows, which
converts an Exists subquery to False when it's known
that the input produces zero rows.

Informs #47058

Release note (performance improvement): The optimizer can now
detect when an Exists subquery can be eliminated because the input
has zero rows. This leads to better plans in some cases.

This commit adds a new rule, EliminateExistsZeroRows, which
converts an Exists subquery to False when it's known
that the input produces zero rows.

Informs cockroachdb#47058

Release note (performance improvement): The optimizer can now
detect when an Exists subquery can be eliminated because the input
has zero rows. This leads to better plans in some cases.
@rytaft rytaft requested a review from a team as a code owner April 29, 2020 15:46
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@blathers-crl
Copy link

blathers-crl bot commented Apr 29, 2020

❌ The GitHub CI (Cockroach) build has failed on 67a1d4d7.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

Copy link
Member

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: Nice!

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @mgartner and @RaduBerinde)

@RaduBerinde
Copy link
Member

Thanks for looking into the regression! I added an entry to #43438 to propagate soft-limit of 1 to Exists input (not exactly related to this change, but the tests around the rule that removes Limit made me think of it).

Copy link
Collaborator

@mgartner mgartner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r1.
Reviewable status: :shipit: complete! 2 of 0 LGTMs obtained (waiting on @rytaft)

a discussion (no related file):
:lgtm: What a simple and beautiful rule!


Copy link
Collaborator Author

@rytaft rytaft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TFTRs! And thanks for adding that TODO for soft-limit 1 for Exists, @RaduBerinde.

bors r+

Reviewable status: :shipit: complete! 2 of 0 LGTMs obtained (waiting on @rytaft)

@craig
Copy link
Contributor

craig bot commented Apr 29, 2020

Build failed (retrying...)

@craig
Copy link
Contributor

craig bot commented Apr 29, 2020

Build succeeded

@craig craig bot merged commit 456d01b into cockroachdb:master Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants