Skip to content

opt: take advantage of index ordering for lookup joins #84685

@DrewKimball

Description

@DrewKimball

Is your feature request related to a problem? Please describe.
When the streamer is in InOrderMode or the old code path has MaintainOrdering set and parallelism disabled, lookup results for each input row are returned in the order of the lookup index. However, the optimizer does not know this, and only passes through input orderings for lookup joins. This leads to unnecessary sorting, which can have a drastic impact on performance because sort operators have to buffer all input rows (no pipelining).

Describe the solution you'd like
We should teach the optimizer that lookup joins can provide orderings that include index columns. This will allow us to avoid sorting in more cases.

Jira issue: CRDB-17796

Metadata

Metadata

Assignees

Labels

C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)T-sql-queriesSQL Queries Team

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions