[YSQL] Support Mixed Sort Order in YSQL using LSM Indexes #22394
Labels
area/ysql
Yugabyte SQL (YSQL)
kind/bug
This issue is a bug
priority/medium
Medium priority issue
status/awaiting-triage
Issue awaiting triage
Jira Link: DB-11293
Description
Mixed Sort Order
One of the primary advantages of having a multi-dimensional index with skip style access is support for more flexible sort orders. Consider the following query for example for the same table as above
produces a plan
However, skip scan allows us to backwards scan on r2 for each distinct key of r1 thus avoiding a sort completely. Implementing this for a single tablet server is simply not sufficient. Instead, the PgGate layer needs to merge outputs from multiple tablets at the boundaries appropriately. Take the same example as above,
we receive output
(1,500), ..., (1,1)
from tablet 1 and we receive output(1,1000), (1,501)
from tablet 2. In the straightforward ordering case, we could have appended output from tablet 2 to tablet 1, but now we need to output the top elements from tablet 2 before the bottom elements in tablet 1 during the merge.Issue Type
kind/bug
Warning: Please confirm that this issue does not contain any sensitive information
The text was updated successfully, but these errors were encountered: