Commit 902c2d6
committed
ORCA: Fix window function cost model producing zero local cost when no ORDER BY
When a window function has no ORDER BY clause (empty Order Spec),
ulSortCols is 0, causing the local cost of SequenceProject operators
to be zero. This makes CPhysicalParallelSequenceProject and
CPhysicalSequenceProject have identical costs, and the optimizer
falls back to insertion order to break the tie, always preferring
the non-parallel variant.
Fix by using max(ulSortCols, 1) so the window function evaluation
cost is never zero, allowing the parallel operator to demonstrate
its cost advantage through the parallelization divisor.1 parent 98240f9 commit 902c2d6
1 file changed
+11
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1622 | 1622 | | |
1623 | 1623 | | |
1624 | 1624 | | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
1625 | 1628 | | |
1626 | | - | |
| 1629 | + | |
1627 | 1630 | | |
1628 | 1631 | | |
1629 | 1632 | | |
1630 | | - | |
| 1633 | + | |
1631 | 1634 | | |
1632 | 1635 | | |
1633 | 1636 | | |
1634 | 1637 | | |
1635 | 1638 | | |
1636 | | - | |
| 1639 | + | |
1637 | 1640 | | |
1638 | 1641 | | |
1639 | | - | |
| 1642 | + | |
1640 | 1643 | | |
1641 | 1644 | | |
1642 | 1645 | | |
| |||
1675 | 1678 | | |
1676 | 1679 | | |
1677 | 1680 | | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
1678 | 1684 | | |
1679 | | - | |
| 1685 | + | |
1680 | 1686 | | |
1681 | 1687 | | |
1682 | 1688 | | |
| |||
0 commit comments