- Notifications
You must be signed in to change notification settings - Fork5
Commit0d5fbdc
committed
Change plan caching to honor, not resist, changes in search_path.
In the initial implementation of plan caching, we saved the activesearch_path when a plan was first cached, then reinstalled that pathanytime we needed to reparse or replan. The idea of that was to try toreselect the same referenced objects, in somewhat the same way that viewscontinue to refer to the same objects in the face of schema or namechanges. Of course, that analogy doesn't bear close inspection, sinceholding the search_path fixed doesn't cope with object drops or renames.Moreover sticking with the old path seems to create more surprises thanit avoids. So instead of doing that, consider that the cached plan dependson search_path, and force reparse/replan if the active search_path isdifferent than it was when we last saved the plan.This gets us fairly close to having "transparency" of plan caching, in thesense that the cached statement acts the same as if you'd just resubmittedthe original query text for another execution. There are still some cornercases where this fails though: a new object added in the search pathschema(s) might capture a reference in the query text, but we'd not realizethat and force a reparse. We might try to fix that in the future, but forthe moment it looks too expensive and complicated.1 parentd309be0 commit0d5fbdc
File tree
9 files changed
+111
-47
lines changed- doc/src/sgml
- ref
- src
- backend
- catalog
- utils/cache
- include
- catalog
- utils
- test/regress
- expected
- sql
9 files changed
+111
-47
lines changedLines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4258 | 4258 |
| |
4259 | 4259 |
| |
4260 | 4260 |
| |
4261 |
| - | |
| 4261 | + | |
| 4262 | + | |
| 4263 | + | |
4262 | 4264 |
| |
4263 | 4265 |
| |
4264 | 4266 |
| |
|
Lines changed: 22 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
152 | 152 |
| |
153 | 153 |
| |
154 | 154 |
| |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
155 | 177 |
| |
156 | 178 |
| |
157 | 179 |
| |
|
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
975 | 975 |
| |
976 | 976 |
| |
977 | 977 |
| |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
978 | 992 |
| |
979 | 993 |
| |
980 | 994 |
| |
|
Lines changed: 22 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3096 | 3096 |
| |
3097 | 3097 |
| |
3098 | 3098 |
| |
| 3099 | + | |
| 3100 | + | |
| 3101 | + | |
| 3102 | + | |
| 3103 | + | |
| 3104 | + | |
| 3105 | + | |
| 3106 | + | |
| 3107 | + | |
| 3108 | + | |
| 3109 | + | |
| 3110 | + | |
| 3111 | + | |
| 3112 | + | |
| 3113 | + | |
| 3114 | + | |
| 3115 | + | |
| 3116 | + | |
| 3117 | + | |
| 3118 | + | |
| 3119 | + | |
| 3120 | + | |
3099 | 3121 |
| |
3100 | 3122 |
| |
3101 | 3123 |
| |
|
Lines changed: 43 additions & 41 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
15 | 15 |
| |
16 | 16 |
| |
17 | 17 |
| |
18 |
| - | |
| 18 | + | |
| 19 | + | |
19 | 20 |
| |
20 | 21 |
| |
21 | 22 |
| |
22 |
| - | |
23 |
| - | |
24 |
| - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
25 | 27 |
| |
26 | 28 |
| |
27 | 29 |
| |
| |||
174 | 176 |
| |
175 | 177 |
| |
176 | 178 |
| |
177 |
| - | |
178 | 179 |
| |
179 | 180 |
| |
180 | 181 |
| |
181 | 182 |
| |
| 183 | + | |
182 | 184 |
| |
183 | 185 |
| |
184 | 186 |
| |
| |||
239 | 241 |
| |
240 | 242 |
| |
241 | 243 |
| |
242 |
| - | |
243 | 244 |
| |
244 | 245 |
| |
245 | 246 |
| |
246 | 247 |
| |
| 248 | + | |
247 | 249 |
| |
248 | 250 |
| |
249 | 251 |
| |
| |||
360 | 362 |
| |
361 | 363 |
| |
362 | 364 |
| |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
363 | 373 |
| |
364 | 374 |
| |
365 | 375 |
| |
| |||
383 | 393 |
| |
384 | 394 |
| |
385 | 395 |
| |
386 |
| - | |
387 |
| - | |
388 |
| - | |
389 |
| - | |
390 |
| - | |
391 |
| - | |
392 | 396 |
| |
393 | 397 |
| |
394 | 398 |
| |
| |||
546 | 550 |
| |
547 | 551 |
| |
548 | 552 |
| |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
549 | 570 |
| |
550 | 571 |
| |
551 | 572 |
| |
| |||
578 | 599 |
| |
579 | 600 |
| |
580 | 601 |
| |
| 602 | + | |
581 | 603 |
| |
582 | 604 |
| |
583 | 605 |
| |
| |||
602 | 624 |
| |
603 | 625 |
| |
604 | 626 |
| |
605 |
| - | |
606 |
| - | |
607 |
| - | |
608 |
| - | |
609 |
| - | |
610 |
| - | |
611 |
| - | |
612 |
| - | |
613 | 627 |
| |
614 | 628 |
| |
615 | 629 |
| |
| |||
645 | 659 |
| |
646 | 660 |
| |
647 | 661 |
| |
648 |
| - | |
649 |
| - | |
650 |
| - | |
651 | 662 |
| |
652 | 663 |
| |
653 | 664 |
| |
| |||
699 | 710 |
| |
700 | 711 |
| |
701 | 712 |
| |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
702 | 720 |
| |
703 | 721 |
| |
704 | 722 |
| |
| |||
848 | 866 |
| |
849 | 867 |
| |
850 | 868 |
| |
851 |
| - | |
852 |
| - | |
853 |
| - | |
854 |
| - | |
855 |
| - | |
856 |
| - | |
857 |
| - | |
858 |
| - | |
859 |
| - | |
860 |
| - | |
861 |
| - | |
862 |
| - | |
863 |
| - | |
864 |
| - | |
865 | 869 |
| |
866 | 870 |
| |
867 | 871 |
| |
| |||
894 | 898 |
| |
895 | 899 |
| |
896 | 900 |
| |
897 |
| - | |
898 |
| - | |
899 |
| - | |
900 | 901 |
| |
901 | 902 |
| |
902 | 903 |
| |
| |||
1268 | 1269 |
| |
1269 | 1270 |
| |
1270 | 1271 |
| |
1271 |
| - | |
1272 | 1272 |
| |
1273 | 1273 |
| |
1274 | 1274 |
| |
| |||
1280 | 1280 |
| |
1281 | 1281 |
| |
1282 | 1282 |
| |
| 1283 | + | |
| 1284 | + | |
1283 | 1285 |
| |
1284 | 1286 |
| |
1285 | 1287 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
128 | 128 |
| |
129 | 129 |
| |
130 | 130 |
| |
| 131 | + | |
131 | 132 |
| |
132 | 133 |
| |
133 | 134 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
86 | 86 |
| |
87 | 87 |
| |
88 | 88 |
| |
89 |
| - | |
90 | 89 |
| |
91 | 90 |
| |
92 | 91 |
| |
93 | 92 |
| |
94 | 93 |
| |
| 94 | + | |
| 95 | + | |
95 | 96 |
| |
96 | 97 |
| |
97 | 98 |
| |
|
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
163 | 163 |
| |
164 | 164 |
| |
165 | 165 |
| |
166 |
| - | |
| 166 | + | |
167 | 167 |
| |
168 | 168 |
| |
169 | 169 |
| |
| |||
188 | 188 |
| |
189 | 189 |
| |
190 | 190 |
| |
191 |
| - | |
| 191 | + | |
192 | 192 |
| |
193 | 193 |
| |
194 | 194 |
| |
195 | 195 |
| |
196 | 196 |
| |
197 | 197 |
| |
198 |
| - | |
| 198 | + | |
199 | 199 |
| |
200 | 200 |
| |
201 | 201 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
94 | 94 |
| |
95 | 95 |
| |
96 | 96 |
| |
97 |
| - | |
| 97 | + | |
98 | 98 |
| |
99 | 99 |
| |
100 | 100 |
| |
|
0 commit comments
Comments
(0)