cockroachdb / cockroachdb/cockroach

sql: distsql=auto row-count heuristic ignores gateway-to-leaseholder locality

Open
#171,466 1 comment 0 reactions 0 assignees View on GitHub
A-multiregion A-sql-execution A-sql-optimizer C-bug O-agent O-support P-2 T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

`distsql=auto` decides local-vs-distributed from estimated row count alone. #137072 and #137562 (v25.1) made small-estimate plans run locally on the gateway. When the gateway is remote from the leaseholders (pinned to a primary region via `lease_preferences`), a "local" plan issues every dependent KV wave across the WAN, ~2x latency. The heuristic never accounts for gateway-to-leaseholder RTT, so "local" is assumed cheap when it isn't.

The fix belongs with #47226 (make distribution locality/latency-aware). Distinct from #87234 (locality-optimized search, not the row-count heuristic). Revealed by Zendesk [#31507](https://cockroachdb.zendesk.com/agent/tickets/31507).

Jira issue: CRDB-64573

Epic CRDB-65886

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.