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: reduce reptitive partial index and constraint predicate building #60943

Open
mgartner opened this issue Feb 22, 2021 · 1 comment
Open
Assignees
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-sql-queries SQL Queries Team

Comments

@mgartner
Copy link
Collaborator

mgartner commented Feb 22, 2021

We may build partial index and unique constraint predicates multiple times in optbuilder. For example, an INSERT ON CONFLICT will build a partial unique constraint predicate when determining arbiters and when building uniqueness checks. We should consider caching the built expressions to the table metadata.

Also, we may be able to eliminate any rebuilding of partial index predicates in arbiter-related code by using the predicates already built in the fetchScope (assuming we build and assign mutationBuilder.fetchScope before we try to find arbiters.

Finally, we build a partial unique constraint predicate thrice when building uniqueness checks for UPDATEs: to determine the column ordinals referenced in the predicate, to filter the WithScan, and to filter the Scan.

Jira issue: CRDB-3096

@mgartner mgartner added the C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) label Feb 22, 2021
@mgartner mgartner self-assigned this Feb 22, 2021
@github-actions
Copy link

We have marked this issue as stale because it has been inactive for
18 months. If this issue is still relevant, removing the stale label
or adding a comment will keep it active. Otherwise, we'll close it in
10 days to keep the issue queue tidy. Thank you for your contribution
to CockroachDB!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-sql-queries SQL Queries Team
Projects
Status: Backlog
Development

No branches or pull requests

2 participants