cockroachdb / cockroach

CockroachDB - the open source, cloud-native distributed SQL database.
https://www.cockroachlabs.com
Other
29.59k stars 3.71k forks source link

Account for join reader batch size in optimizer costing #87473

Open msirek opened 1 year ago

msirek commented 1 year ago

Is your feature request related to a problem? Please describe. A particular lookup join query plan is slower than hash join with default cluster settings, but faster than hash join when cluster setting sql.distsql.join_reader_ordering_strategy.batch_size is increased. The lookup join query plan must be hinted to get picked by the optimizer. It would be nice if the faster join could get picked without a join hint.

Describe the solution you'd like Enhance the optimizer cost model to account for the sql.distsql.join_reader_ordering_strategy.batch_size cluster setting value.

Describe alternatives you've considered None

Additional context Statement bundles with a known test case are available here.

Jira issue: CRDB-19358

mgartner commented 1 year ago

Some of the assumptions in the cost model may be incorrect with the new streamer implementation, so we might want to re-evaluate that.

github-actions[bot] commented 3 months ago

We have marked this issue as stale because it has been inactive for 18 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to CockroachDB!