Is your feature request related to a problem? Please describe.
#84689 improves the number of cases a sort is avoided for lookup join queries with ORDER BY on the lookup index columns, but does not handle descending index columns
Example:
CREATE TABLE xyz (x INT, y INT, z INT, PRIMARY KEY(x, y, z));
CREATE TABLE uvw (u INT, v INT, w INT, PRIMARY KEY(u, v, w));
The following avoids a sort:
SELECT * FROM xyz INNER LOOKUP JOIN uvw ON x = u AND y = v ORDER BY x, y, z, u, v, w;
But if the PK of table uvw is (u, v, w DESC) and we have ORDER BY x, y, z, u, v, w DESC; This should avoid a sort.
A reverse scan is not required so I believe lookup join should be able to support it.
Describe alternatives you've considered
None
Jira issue: CRDB-19769
Is your feature request related to a problem? Please describe.
#84689 improves the number of cases a sort is avoided for lookup join queries with ORDER BY on the lookup index columns, but does not handle descending index columns
Example:
The following avoids a sort:
But if the PK of table uvw is (u, v, w DESC) and we have ORDER BY x, y, z, u, v, w DESC; This should avoid a sort.
A reverse scan is not required so I believe lookup join should be able to support it.
Describe alternatives you've considered
None
Jira issue: CRDB-19769