cockroachdb / cockroachdb/cockroach

sql: make join algorithm choice adaptive

Open
#152,922 0 comments 0 reactions 0 assignees View on GitHub
A-sql-execution A-sql-optimizer C-enhancement C-performance O-support P-3 T-sql-queries
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

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.