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: set min row count of 1 for FK check WithScans #140735

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mgartner
Copy link
Collaborator

@mgartner mgartner commented Feb 7, 2025

Fixes #137547

Release note (performance improvement): The optimizer previously
selected poor indexes to perform foreign key checks in rare cases. It
now selects better indexes.

@mgartner mgartner requested a review from a team February 7, 2025 23:10
@mgartner mgartner requested a review from a team as a code owner February 7, 2025 23:10
@mgartner mgartner requested review from DrewKimball and removed request for a team February 7, 2025 23:10
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@mgartner mgartner force-pushed the 137547-clamp-fk-input-1 branch from 36833c2 to 4442ca1 Compare February 7, 2025 23:10
Fixes cockroachdb#137547

Release note (performance improvement): The optimizer previously
selected poor indexes to perform foreign key checks in rare cases. It
now selects better indexes.
@mgartner mgartner force-pushed the 137547-clamp-fk-input-1 branch from 4442ca1 to 3d8f549 Compare February 7, 2025 23:11
Copy link
Collaborator

@michae2 michae2 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!

Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @DrewKimball)

Copy link
Member

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

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

:lgmt: Should we backport this with a session var disabled by default?

Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @DrewKimball)

Copy link
Collaborator

@DrewKimball DrewKimball left a comment

Choose a reason for hiding this comment

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

:lgtm: Cool!

Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: :shipit: complete! 2 of 0 LGTMs obtained (waiting on @mgartner)


pkg/sql/opt/optbuilder/mutation_builder.go line 1773 at r1 (raw file):

		OutCols:      outScope.colList(),
		ID:           mb.b.factory.Metadata().NextUniqueID(),
		FKCheckInput: true,

nit: this also gets set for uniqueness checks, right? That's probably desirable, but makes the naming a little confusing.

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.

opt: clamp estimated row count of FK check input to 1
5 participants