opt: reduce reptitive partial index and constraint predicate building #60943
Labels
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
T-sql-queries
SQL Queries Team
We may build partial index and unique constraint predicates multiple times in
optbuilder
. For example, anINSERT 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
UPDATE
s: to determine the column ordinals referenced in the predicate, to filter the WithScan, and to filter the Scan.Jira issue: CRDB-3096
The text was updated successfully, but these errors were encountered: