A rule that pushes a sort into a compatibly-ordered index scan, including one with existing comparisons
(from filters or other sort orders) that might affect whether the index is compatibly ordered.
+-----------------------------+ +---------------------------+
| | | |
| LogicalSortExpression | | LogicalSortExpression |
| prefix, suffix | | suffix |
| | | |
+-------------+---------------+ +-------------+-------------+
| +------> |
| qun | newQun
| |
+---------------+------------------+ +---------------+------------------+
| | | |
| IndexEntrySourceScanExpression | | IndexEntrySourceScanExpression |
| orders | | order|prefix |
| | | |
+----------------------------------+ +----------------------------------+
or if there are no other predicates
+-----------------------------+ +----------------------------------+
| | | |
| LogicalSortExpression | +------> | IndexEntrySourceScanExpression |
| prefix | | orders |
| | | |
+-------------+---------------+ +----------------------------------+
|
| qun
|
+---------------+------------------+
| |
| IndexEntrySourceScanExpression |
| orders |
| |
+----------------------------------+