- Notifications
You must be signed in to change notification settings - Fork5
Commite3ffd05
committed
Weaken the planner's tests for relevant joinclauses.
We should be willing to cross-join two small relations if that allows usto use an inner indexscan on a large relation (that is, the potentialindexqual for the large table requires both smaller relations). Thisworked in simple cases but fell apart as soon as there was a join clauseto a fourth relation, because the existence of any two-relation join clausecaused the planner to not consider clauseless joins between other baserelations. The added regression test shows an example case adapted froma recent complaint from Benoit Delbosc.Adjust have_relevant_joinclause, have_relevant_eclass_joinclause, andhas_relevant_eclass_joinclause to consider that a join clause mentioningthree or more relations is sufficient grounds for joining any subset ofthose relations, even if we have to do so via a cartesian join. Since suchclauses are relatively uncommon, this shouldn't affect planning speed ontypical queries; in fact it should help a bit, because the latter twofunctions in particular get significantly simpler.Although this is arguably a bug fix, I'm not going to risk back-patchingit, since it might have currently-unforeseen consequences.1 parentc0cc526 commite3ffd05
File tree
5 files changed
+110
-93
lines changed- src
- backend/optimizer
- path
- util
- test/regress
- expected
- sql
5 files changed
+110
-93
lines changedLines changed: 19 additions & 77 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2035 | 2035 |
| |
2036 | 2036 |
| |
2037 | 2037 |
| |
2038 |
| - | |
| 2038 | + | |
2039 | 2039 |
| |
2040 | 2040 |
| |
2041 | 2041 |
| |
| |||
2051 | 2051 |
| |
2052 | 2052 |
| |
2053 | 2053 |
| |
2054 |
| - | |
2055 |
| - | |
2056 |
| - | |
2057 | 2054 |
| |
2058 | 2055 |
| |
2059 | 2056 |
| |
| |||
2063 | 2060 |
| |
2064 | 2061 |
| |
2065 | 2062 |
| |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
2066 | 2072 |
| |
2067 |
| - | |
2068 |
| - | |
| 2073 | + | |
| 2074 | + | |
2069 | 2075 |
| |
2070 | 2076 |
| |
2071 | 2077 |
| |
2072 | 2078 |
| |
2073 | 2079 |
| |
2074 | 2080 |
| |
2075 | 2081 |
| |
2076 |
| - | |
2077 |
| - | |
2078 |
| - | |
2079 |
| - | |
2080 |
| - | |
2081 |
| - | |
2082 |
| - | |
2083 |
| - | |
2084 |
| - | |
2085 |
| - | |
2086 |
| - | |
2087 |
| - | |
2088 |
| - | |
2089 |
| - | |
2090 |
| - | |
2091 |
| - | |
2092 |
| - | |
2093 |
| - | |
2094 |
| - | |
2095 |
| - | |
2096 |
| - | |
2097 |
| - | |
2098 |
| - | |
2099 |
| - | |
2100 |
| - | |
2101 |
| - | |
2102 |
| - | |
2103 |
| - | |
2104 |
| - | |
| 2082 | + | |
| 2083 | + | |
2105 | 2084 |
| |
2106 | 2085 |
| |
2107 | 2086 |
| |
| |||
2112 | 2091 |
| |
2113 | 2092 |
| |
2114 | 2093 |
| |
2115 |
| - | |
| 2094 | + | |
2116 | 2095 |
| |
2117 | 2096 |
| |
2118 | 2097 |
| |
| |||
2125 | 2104 |
| |
2126 | 2105 |
| |
2127 | 2106 |
| |
2128 |
| - | |
2129 |
| - | |
2130 |
| - | |
2131 | 2107 |
| |
2132 | 2108 |
| |
2133 | 2109 |
| |
| |||
2137 | 2113 |
| |
2138 | 2114 |
| |
2139 | 2115 |
| |
2140 |
| - | |
2141 |
| - | |
2142 |
| - | |
2143 |
| - | |
2144 |
| - | |
2145 |
| - | |
2146 |
| - | |
2147 |
| - | |
2148 |
| - | |
| 2116 | + | |
| 2117 | + | |
2149 | 2118 |
| |
2150 |
| - | |
2151 |
| - | |
2152 |
| - | |
2153 |
| - | |
2154 |
| - | |
2155 |
| - | |
2156 |
| - | |
2157 |
| - | |
2158 |
| - | |
2159 |
| - | |
2160 |
| - | |
2161 |
| - | |
2162 |
| - | |
2163 |
| - | |
2164 |
| - | |
2165 |
| - | |
2166 |
| - | |
2167 |
| - | |
2168 |
| - | |
2169 |
| - | |
2170 |
| - | |
2171 |
| - | |
2172 |
| - | |
2173 |
| - | |
2174 |
| - | |
2175 |
| - | |
2176 |
| - | |
2177 |
| - | |
2178 |
| - | |
| 2119 | + | |
| 2120 | + | |
2179 | 2121 |
| |
2180 | 2122 |
| |
2181 | 2123 |
| |
|
Lines changed: 5 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
88 | 88 |
| |
89 | 89 |
| |
90 | 90 |
| |
91 |
| - | |
92 |
| - | |
93 |
| - | |
94 |
| - | |
95 |
| - | |
96 |
| - | |
97 |
| - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
98 | 94 |
| |
99 | 95 |
| |
100 | 96 |
| |
| |||
160 | 156 |
| |
161 | 157 |
| |
162 | 158 |
| |
163 |
| - | |
164 |
| - | |
| 159 | + | |
| 160 | + | |
165 | 161 |
| |
166 | 162 |
| |
167 | 163 |
| |
|
Lines changed: 17 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
21 | 21 |
| |
22 | 22 |
| |
23 | 23 |
| |
24 |
| - | |
| 24 | + | |
25 | 25 |
| |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
26 | 34 |
| |
27 | 35 |
| |
28 | 36 |
| |
29 | 37 |
| |
30 | 38 |
| |
31 | 39 |
| |
32 |
| - | |
33 | 40 |
| |
| 41 | + | |
34 | 42 |
| |
35 | 43 |
| |
36 |
| - | |
37 |
| - | |
38 | 44 |
| |
39 | 45 |
| |
40 | 46 |
| |
41 | 47 |
| |
42 | 48 |
| |
| 49 | + | |
43 | 50 |
| |
| 51 | + | |
| 52 | + | |
44 | 53 |
| |
| 54 | + | |
45 | 55 |
| |
| 56 | + | |
| 57 | + | |
46 | 58 |
| |
47 | 59 |
| |
48 | 60 |
| |
49 | 61 |
| |
50 | 62 |
| |
51 |
| - | |
| 63 | + | |
52 | 64 |
| |
53 | 65 |
| |
54 | 66 |
| |
| |||
62 | 74 |
| |
63 | 75 |
| |
64 | 76 |
| |
65 |
| - | |
66 |
| - | |
67 | 77 |
| |
68 | 78 |
| |
69 | 79 |
| |
|
Lines changed: 51 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2666 | 2666 |
| |
2667 | 2667 |
| |
2668 | 2668 |
| |
| 2669 | + | |
| 2670 | + | |
| 2671 | + | |
| 2672 | + | |
| 2673 | + | |
| 2674 | + | |
| 2675 | + | |
| 2676 | + | |
| 2677 | + | |
| 2678 | + | |
| 2679 | + | |
| 2680 | + | |
| 2681 | + | |
| 2682 | + | |
| 2683 | + | |
| 2684 | + | |
| 2685 | + | |
| 2686 | + | |
| 2687 | + | |
| 2688 | + | |
| 2689 | + | |
| 2690 | + | |
| 2691 | + | |
| 2692 | + | |
| 2693 | + | |
| 2694 | + | |
| 2695 | + | |
| 2696 | + | |
| 2697 | + | |
| 2698 | + | |
| 2699 | + | |
| 2700 | + | |
| 2701 | + | |
| 2702 | + | |
| 2703 | + | |
| 2704 | + | |
| 2705 | + | |
| 2706 | + | |
| 2707 | + | |
| 2708 | + | |
| 2709 | + | |
| 2710 | + | |
| 2711 | + | |
| 2712 | + | |
| 2713 | + | |
| 2714 | + | |
| 2715 | + | |
| 2716 | + | |
| 2717 | + | |
| 2718 | + | |
| 2719 | + | |
2669 | 2720 |
| |
2670 | 2721 |
| |
2671 | 2722 |
| |
|
Lines changed: 18 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
689 | 689 |
| |
690 | 690 |
| |
691 | 691 |
| |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
692 | 710 |
| |
693 | 711 |
| |
694 | 712 |
| |
|
0 commit comments
Comments
(0)