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
When
SELECT FOR UPDATE SKIP LOCKEDqueries execute, they could encounter two forms of inconsistency we don't see during normal query execution:The optimizer depends on these assumptions in a few places, for example in the
filtersMatchAllLeftRowsfunction, and in thePushLimitIntoIndexJoinrule.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 toSELECT FOR UPDATE SKIP LOCKEDqueries.Jira issue: CRDB-16891
Epic: CRDB-16932