> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cockroachlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Technical Advisory 114393

export const InternalLink = ({version, path = "", children, ...props}) => {
  let detectedVersion = version || "stable";
  if (typeof window !== 'undefined' && !version) {
    const match = window.location.pathname.match(/\/docs\/([^/]+)/);
    if (match) {
      detectedVersion = match[1];
    }
  }
  const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
  return <a href={`/docs/${detectedVersion}/${normalizedPath}`} {...props}>
      {children}
    </a>;
};

Publication date: December 5, 2023

## Description

A critical bug has been identified in the [optimizer](https://www.cockroachlabs.com/docs/v23.1/cost-based-optimizer) that may lead to incorrect query results, affecting queries involving [`REGIONAL BY ROW` tables](https://www.cockroachlabs.com/docs/v23.1/regional-tables#regional-by-row-tables). The bug can cause rows in the local region of a `REGIONAL BY ROW` table to be omitted from query results when performing a [locality-optimized](https://www.cockroachlabs.com/docs/v23.1/cost-based-optimizer#locality-optimized-search-in-multi-region-clusters) [lookup join](https://www.cockroachlabs.com/docs/v23.1/joins#lookup-joins). The bug manifests under the following conditions:

* The query includes at least one join operation, either explicitly with the JOIN keyword or implicitly, for example, a correlated subquery.
* The query fetches data from a `REGIONAL BY ROW` table.
* Additional non-join related filters are present, such as equality (or inequality) conditions with constant values.

## Statement

This fix has been applied to maintenance release of CockroachDB <InternalLink version="releases" path="v23.1#v23-1-13">v23.1.13</InternalLink>, which fixes a bug that could cause a query plan to skip scanning rows from the local region when performing a lookup join with a `REGIONAL BY ROW` table as the input.

## Mitigation

Users running affected versions in multi-region clusters are encouraged to upgrade to <InternalLink version="releases" path="v23.1#v23-1-13">v23.1.13</InternalLink> or a later version.

Without upgrading, the bug can only be prevented by disabling locality-optimized search with the session setting: `SET locality_optimized_partitioned_index_scan=off`. Note that this will increase the latency for some queries involving `REGIONAL BY ROW` tables.

## Impact

Versions affected include v23.1.0 to v23.1.12, and pre-release versions v23.1.0-beta.1, v23.1.0-beta.2, v23.1.0-beta.3, v23.1.0-rc.1, and v23.1.0-rc.2.

Questions about any technical alert can be directed to our [support team](https://support.cockroachlabs.com/).
