cockroachdb / cockroachdb/cockroach
sql: distsql=auto row-count heuristic ignores gateway-to-leaseholder locality
- 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
Assessment
This issue has not been assessed yet.