- Notifications
You must be signed in to change notification settings - Fork5
Commit034967b
committed
Reimplement planner's handling of MIN/MAX aggregate optimization.
Per my recent proposal, get rid of all the direct inspection of indexesand manual generation of paths in planagg.c. Instead, set upEquivalenceClasses for the aggregate argument expressions, and let theregular path generation logic deal with creating paths that can satisfythose sort orders. This makes planagg.c a bit more visible to the restof the planner than it was originally, but the approach is basically a lotcleaner than before. A major advantage of doing it this way is that we getMIN/MAX optimization on inheritance trees (using MergeAppend of indexscans)practically for free, whereas in the old way we'd have had to add a wholelot more duplicative logic.One small disadvantage of this approach is that MIN/MAX aggregates can nolonger exploit partial indexes having an "x IS NOT NULL" predicate, unlessthat restriction or something that implies it is specified in the query.The previous implementation was able to use the added "x IS NOT NULL"condition as an extra predicate proof condition, but in this version werely entirely on indexes that are considered usable by the main planningprocess. That seems a fair tradeoff for the simplicity and functionalitygained.1 parent0abc8fd commit034967b
File tree
18 files changed
+873
-471
lines changed- src
- backend
- nodes
- optimizer
- path
- plan
- prep
- util
- rewrite
- include
- nodes
- optimizer
- test/regress
- expected
- sql
18 files changed
+873
-471
lines changedLines changed: 19 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1837 | 1837 |
| |
1838 | 1838 |
| |
1839 | 1839 |
| |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
1840 | 1856 |
| |
1841 | 1857 |
| |
1842 | 1858 |
| |
| |||
3921 | 3937 |
| |
3922 | 3938 |
| |
3923 | 3939 |
| |
| 3940 | + | |
| 3941 | + | |
| 3942 | + | |
3924 | 3943 |
| |
3925 | 3944 |
| |
3926 | 3945 |
| |
|
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
844 | 844 |
| |
845 | 845 |
| |
846 | 846 |
| |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
847 | 858 |
| |
848 | 859 |
| |
849 | 860 |
| |
| |||
2568 | 2579 |
| |
2569 | 2580 |
| |
2570 | 2581 |
| |
| 2582 | + | |
| 2583 | + | |
| 2584 | + | |
2571 | 2585 |
| |
2572 | 2586 |
| |
2573 | 2587 |
| |
|
Lines changed: 15 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1608 | 1608 |
| |
1609 | 1609 |
| |
1610 | 1610 |
| |
| 1611 | + | |
1611 | 1612 |
| |
1612 | 1613 |
| |
1613 | 1614 |
| |
| |||
1808 | 1809 |
| |
1809 | 1810 |
| |
1810 | 1811 |
| |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
1811 | 1823 |
| |
1812 | 1824 |
| |
1813 | 1825 |
| |
| |||
2845 | 2857 |
| |
2846 | 2858 |
| |
2847 | 2859 |
| |
| 2860 | + | |
| 2861 | + | |
| 2862 | + | |
2848 | 2863 |
| |
2849 | 2864 |
| |
2850 | 2865 |
| |
|
Lines changed: 92 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
912 | 912 |
| |
913 | 913 |
| |
914 | 914 |
| |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
915 | 948 |
| |
916 | 949 |
| |
917 | 950 |
| |
| |||
1379 | 1412 |
| |
1380 | 1413 |
| |
1381 | 1414 |
| |
1382 |
| - | |
1383 |
| - | |
1384 |
| - | |
1385 |
| - | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
1386 | 1420 |
| |
1387 | 1421 |
| |
1388 | 1422 |
| |
| |||
1403 | 1437 |
| |
1404 | 1438 |
| |
1405 | 1439 |
| |
1406 |
| - | |
| 1440 | + | |
1407 | 1441 |
| |
1408 | 1442 |
| |
1409 | 1443 |
| |
| |||
1506 | 1540 |
| |
1507 | 1541 |
| |
1508 | 1542 |
| |
1509 |
| - | |
| 1543 | + | |
1510 | 1544 |
| |
1511 | 1545 |
| |
1512 | 1546 |
| |
| |||
1524 | 1558 |
| |
1525 | 1559 |
| |
1526 | 1560 |
| |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
1527 | 1605 |
| |
1528 | 1606 |
| |
1529 | 1607 |
| |
| |||
1535 | 1613 |
| |
1536 | 1614 |
| |
1537 | 1615 |
| |
| 1616 | + | |
1538 | 1617 |
| |
1539 | 1618 |
| |
1540 | 1619 |
| |
1541 | 1620 |
| |
1542 | 1621 |
| |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
1543 | 1625 |
| |
1544 | 1626 |
| |
1545 | 1627 |
| |
| |||
1565 | 1647 |
| |
1566 | 1648 |
| |
1567 | 1649 |
| |
1568 |
| - | |
1569 |
| - | |
| 1650 | + | |
| 1651 | + | |
1570 | 1652 |
| |
1571 | 1653 |
| |
1572 | 1654 |
| |
| |||
1575 | 1657 |
| |
1576 | 1658 |
| |
1577 | 1659 |
| |
| 1660 | + | |
| 1661 | + | |
1578 | 1662 |
| |
1579 | 1663 |
|
Lines changed: 2 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
81 | 81 |
| |
82 | 82 |
| |
83 | 83 |
| |
| 84 | + | |
84 | 85 |
| |
85 | 86 |
| |
86 | 87 |
| |
| |||
2396 | 2397 |
| |
2397 | 2398 |
| |
2398 | 2399 |
| |
2399 |
| - | |
2400 |
| - | |
2401 | 2400 |
| |
2402 |
| - | |
| 2401 | + | |
2403 | 2402 |
| |
2404 | 2403 |
| |
2405 | 2404 |
| |
|
0 commit comments
Comments
(0)