Description
In CockroachDB to , querying aREGIONAL BY ROW or partitioned multi-region table with an inverted index could produce incorrect results if the query has a LIMIT of less than 100,000 and uses the inverted index. In this case, it is possible that the optimizer will erroneously discard the predicate over the inverted index and therefore return some rows that do not match the predicate.
Statement
The fix has been applied to the maintenance release of CockroachDB .Mitigation
Users of CockroachDB to are encouraged to upgrade to or a later version. To determine whether your queries may be affected by this issue on to , you should examine the query plans of anyLIMIT queries over REGIONAL BY ROW or partitioned multi-region tables with inverted indexes by using EXPLAIN (OPT). If the resulting plan shows locality-optimized-search, these queries may produce incorrect results.
For example:
REGIONAL BY ROW and partitioned multi-region tables, or set the session setting locality_optimized_partitioned_index_scan or cluster setting sql.defaults.locality_optimized_partitioned_index_scan.enabled to false, which disables locality-optimized-search.
The best mitigation, however, is to upgrade to as soon as possible.
Impact
Some queries overREGIONAL BY ROW or partitioned multi-region tables with a LIMIT clause could produce incorrect results if the scanned index is INVERTED and uses an inverted constraint with JSONB operators, ARRAY operators, or operators on spatial data. Versions affected include to .
Please reach out to the support team if more information or assistance is needed.
