cockroachdb / cockroachdb/cockroach
sql: make join algorithm choice adaptive
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
It is inevitable that the optimizer will have poor row-count estimates for some queries, which can result in a bad choice of join algorithm (e.g. lookup-join that processes too many rows, or a hash-join that requires a full scan on both inputs). While improving stats is one way to improve this situation, another option is to make execution more robust to poor row-count estimates. We could adaptively choose between lookup-join and hash-join based on how many rows the input _actually_ has. That way, a small input could use a lookup-join, and a large input could use a hash-join, regardless of how many rows the optimizer expects.
Jira issue: CRDB-54112
Contributor guide
Assessment
This issue has not been assessed yet.