Commit 8df08c8
committed
Reimplement planner's handling of MIN/MAX aggregate optimization (again).
Instead of playing cute games with pathkeys, just build a direct
representation of the intended sub-select, and feed it through
query_planner to get a Path for the index access. This is a bit slower
than 9.1's previous method, since we'll duplicate most of the overhead of
query_planner; but since the whole optimization only applies to rather
simple single-table queries, that probably won't be much of a problem in
practice. The advantage is that we get to do the right thing when there's
a partial index that needs the implicit IS NOT NULL clause to be usable.
Also, although this makes planagg.c be a bit more closely tied to the
ordering of operations in grouping_planner, we can get rid of some coupling
to lower-level parts of the planner. Per complaint from Marti Raudsepp.1 parent 6d8096e commit 8df08c8
File tree
12 files changed
+263
-545
lines changed- src
- backend
- nodes
- optimizer
- path
- plan
- include
- nodes
- optimizer
- test/regress
- expected
- sql
12 files changed
+263
-545
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1930 | 1930 | | |
1931 | 1931 | | |
1932 | 1932 | | |
1933 | | - | |
1934 | | - | |
1935 | | - | |
1936 | | - | |
1937 | | - | |
1938 | | - | |
1939 | | - | |
1940 | | - | |
1941 | | - | |
1942 | | - | |
1943 | | - | |
1944 | | - | |
1945 | | - | |
1946 | | - | |
1947 | | - | |
1948 | | - | |
1949 | 1933 | | |
1950 | 1934 | | |
1951 | 1935 | | |
| |||
4129 | 4113 | | |
4130 | 4114 | | |
4131 | 4115 | | |
4132 | | - | |
4133 | | - | |
4134 | | - | |
4135 | 4116 | | |
4136 | 4117 | | |
4137 | 4118 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
886 | 886 | | |
887 | 887 | | |
888 | 888 | | |
889 | | - | |
890 | | - | |
891 | | - | |
892 | | - | |
893 | | - | |
894 | | - | |
895 | | - | |
896 | | - | |
897 | | - | |
898 | | - | |
899 | | - | |
900 | 889 | | |
901 | 890 | | |
902 | 891 | | |
| |||
2690 | 2679 | | |
2691 | 2680 | | |
2692 | 2681 | | |
2693 | | ||
2694 | | - | |
2695 | | - | |
2696 | 2682 | | |
2697 | 2683 | | |
2698 | 2684 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1914 | 1914 | | |
1915 | 1915 | | |
1916 | 1916 | | |
1917 | | - | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
1918 | 1921 | | |
1919 | 1922 | | |
1920 | 1923 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
44 | 51 | | |
45 | 52 | | |
46 | 53 | | |
| |||
78 | 85 | | |
79 | 86 | | |
80 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
81 | 93 | | |
82 | 94 | | |
83 | 95 | | |
| |||
1060 | 1072 | | |
1061 | 1073 | | |
1062 | 1074 | | |
1063 | | - | |
| 1075 | + | |
1064 | 1076 | | |
1065 | 1077 | | |
1066 | 1078 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
905 | 905 | | |
906 | 906 | | |
907 | 907 | | |
908 | | - | |
909 | | - | |
910 | | - | |
911 | | - | |
912 | | - | |
913 | | - | |
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 | 908 | | |
942 | 909 | | |
943 | 910 | | |
| |||
1407 | 1374 | | |
1408 | 1375 | | |
1409 | 1376 | | |
1410 | | - | |
1411 | | - | |
1412 | | - | |
1413 | | - | |
1414 | | - | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
1415 | 1381 | | |
1416 | 1382 | | |
1417 | 1383 | | |
| |||
1553 | 1519 | | |
1554 | 1520 | | |
1555 | 1521 | | |
1556 | | - | |
1557 | | - | |
1558 | | - | |
1559 | | - | |
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 | 1522 | | |
1601 | 1523 | | |
1602 | 1524 | | |
| |||
1608 | 1530 | | |
1609 | 1531 | | |
1610 | 1532 | | |
1611 | | - | |
1612 | 1533 | | |
1613 | 1534 | | |
1614 | 1535 | | |
1615 | 1536 | | |
1616 | 1537 | | |
1617 | | - | |
1618 | | - | |
1619 | | - | |
1620 | 1538 | | |
1621 | 1539 | | |
1622 | 1540 | | |
| |||
1642 | 1560 | | |
1643 | 1561 | | |
1644 | 1562 | | |
1645 | | - | |
1646 | | - | |
| 1563 | + | |
| 1564 | + | |
1647 | 1565 | | |
1648 | 1566 | | |
1649 | 1567 | | |
| |||
1652 | 1570 | | |
1653 | 1571 | | |
1654 | 1572 | | |
1655 | | - | |
1656 | | - | |
1657 | 1573 | | |
1658 | 1574 | | |
0 commit comments