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
Is your feature request related to a problem? Please describe.
When the streamer is in
InOrderModeor the old code path hasMaintainOrderingset 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