Skip to content

opt: add hint to ignore preserved-multiplicity consistency #83156

@michae2

Description

@michae2

When SELECT FOR UPDATE SKIP LOCKED queries execute, they could encounter two forms of inconsistency we don't see during normal query execution:

  • We might not read a PK row for every secondary index row.
  • We might not read a FK row for every referenced FK.

The optimizer depends on these assumptions in a few places, for example in the filtersMatchAllLeftRows function, and in the PushLimitIntoIndexJoin rule.

We should add a hint to the optimizer, similar to IGNORE_FOREIGN_KEYS, which tells it to disable rules that depend on these consistency assumptions. Then we can add this hint to SELECT FOR UPDATE SKIP LOCKED queries.

Jira issue: CRDB-16891
Epic: CRDB-16932

Metadata

Metadata

Assignees

Labels

A-sql-optimizerSQL logical planning and optimizations.C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)T-sql-queriesSQL Queries Team

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions