forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite9e26b5
committed
Invent "multibitmapsets", and use them to speed up antijoin detection.
Implement a data structure that is a List of Bitmapsets, which isessentially a 2-D boolean array except that the rows need not allbe the same width. Operations such as union and intersection aremeaningful for these, just as they are for Bitmapsets. Eventuallywe might build many of the same operations that we have written forBitmapsets, but for the first use-case we just need a few.That first use-case is for antijoin detection: reduce_outer_joinsneeds to find the set of Vars that are certain to be non-null in asuccessfully joined (not null-extended) left join row, and alsofind the set of Vars subject to higher-level IS NULL constraints,and intersect them. We had been doing this by making Lists ofthe Var nodes and then using list_intersect, which works but ispretty inefficient compared to a bitmapset-like intersection.Potentially it's O(N^2) if there are a lot of Vars involved,which fortunately there generally aren't; still it's not great.Moreover, that method requires the Vars of interest to be exactlyequal() in the join condition and the upper IS NULL condition,which is problematic for my WIP patch that labels Vars accordingto which outer joins have possibly nulled them.Discussion:https://postgr.es/m/892228.1668437838@sss.pgh.pa.usDiscussion:https://postgr.es/m/CAMbWs4-mvPPCJ1W6iK6dD5HiNwoJdi6mZp=-7mE8N9Sh+cd0tQ@mail.gmail.com1 parent90e4f30 commite9e26b5
File tree
7 files changed
+238
-25
lines changed- src
- backend
- nodes
- optimizer
- prep
- util
- include/nodes
7 files changed
+238
-25
lines changedLines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
21 | 21 |
| |
22 | 22 |
| |
23 | 23 |
| |
| 24 | + | |
24 | 25 |
| |
25 | 26 |
| |
26 | 27 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
58 | 58 |
| |
59 | 59 |
| |
60 | 60 |
| |
| 61 | + | |
61 | 62 |
| |
62 | 63 |
| |
63 | 64 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
| 6 | + | |
6 | 7 |
| |
7 | 8 |
| |
8 | 9 |
| |
|
Lines changed: 162 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + |
Lines changed: 9 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
28 | 28 |
| |
29 | 29 |
| |
30 | 30 |
| |
| 31 | + | |
31 | 32 |
| |
32 | 33 |
| |
33 | 34 |
| |
| |||
2769 | 2770 |
| |
2770 | 2771 |
| |
2771 | 2772 |
| |
2772 |
| - | |
| 2773 | + | |
2773 | 2774 |
| |
2774 | 2775 |
| |
2775 | 2776 |
| |
| |||
2799 | 2800 |
| |
2800 | 2801 |
| |
2801 | 2802 |
| |
2802 |
| - | |
2803 |
| - | |
| 2803 | + | |
| 2804 | + | |
2804 | 2805 |
| |
2805 | 2806 |
| |
2806 | 2807 |
| |
| |||
2897 | 2898 |
| |
2898 | 2899 |
| |
2899 | 2900 |
| |
2900 |
| - | |
| 2901 | + | |
2901 | 2902 |
| |
2902 | 2903 |
| |
2903 | 2904 |
| |
| |||
2907 | 2908 |
| |
2908 | 2909 |
| |
2909 | 2910 |
| |
2910 |
| - | |
2911 |
| - | |
2912 |
| - | |
2913 |
| - | |
2914 |
| - | |
| 2911 | + | |
| 2912 | + | |
2915 | 2913 |
| |
2916 | 2914 |
| |
2917 | 2915 |
| |
| |||
2964 | 2962 |
| |
2965 | 2963 |
| |
2966 | 2964 |
| |
2967 |
| - | |
2968 |
| - | |
| 2965 | + | |
| 2966 | + | |
2969 | 2967 |
| |
2970 | 2968 |
| |
2971 | 2969 |
| |
|
Lines changed: 25 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
31 | 31 |
| |
32 | 32 |
| |
33 | 33 |
| |
| 34 | + | |
34 | 35 |
| |
35 | 36 |
| |
36 | 37 |
| |
| |||
1566 | 1567 |
| |
1567 | 1568 |
| |
1568 | 1569 |
| |
1569 |
| - | |
| 1570 | + | |
1570 | 1571 |
| |
1571 | 1572 |
| |
1572 | 1573 |
| |
| |||
1578 | 1579 |
| |
1579 | 1580 |
| |
1580 | 1581 |
| |
1581 |
| - | |
1582 |
| - | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
1583 | 1585 |
| |
1584 | 1586 |
| |
1585 | 1587 |
| |
| |||
1608 | 1610 |
| |
1609 | 1611 |
| |
1610 | 1612 |
| |
1611 |
| - | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
1612 | 1616 |
| |
1613 | 1617 |
| |
1614 | 1618 |
| |
| |||
1623 | 1627 |
| |
1624 | 1628 |
| |
1625 | 1629 |
| |
1626 |
| - | |
1627 |
| - | |
1628 |
| - | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
1629 | 1633 |
| |
1630 | 1634 |
| |
1631 | 1635 |
| |
| |||
1657 | 1661 |
| |
1658 | 1662 |
| |
1659 | 1663 |
| |
1660 |
| - | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
1661 | 1670 |
| |
1662 | 1671 |
| |
1663 | 1672 |
| |
| |||
1689 | 1698 |
| |
1690 | 1699 |
| |
1691 | 1700 |
| |
1692 |
| - | |
| 1701 | + | |
1693 | 1702 |
| |
1694 | 1703 |
| |
1695 | 1704 |
| |
| |||
1788 | 1797 |
| |
1789 | 1798 |
| |
1790 | 1799 |
| |
1791 |
| - | |
1792 |
| - | |
| 1800 | + | |
| 1801 | + | |
1793 | 1802 |
| |
1794 | 1803 |
| |
1795 | 1804 |
| |
| |||
1804 | 1813 |
| |
1805 | 1814 |
| |
1806 | 1815 |
| |
1807 |
| - | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
1808 | 1819 |
| |
1809 | 1820 |
| |
1810 | 1821 |
| |
| |||
1815 | 1826 |
| |
1816 | 1827 |
| |
1817 | 1828 |
| |
1818 |
| - | |
1819 |
| - | |
| 1829 | + | |
| 1830 | + | |
1820 | 1831 |
| |
1821 | 1832 |
| |
1822 | 1833 |
| |
|
Lines changed: 39 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + |
0 commit comments
Comments
(0)