forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite23bae8
committed
Fix up run-time partition pruning's use of relcache's partition data.
The previous coding saved pointers into the partitioned table's relcacheentry, but then closed the relcache entry, causing those pointers tonominally become dangling. Actual trouble would be seen in the fieldonly if a relcache flush occurred mid-query, but that's hardly out ofthe question.While we could fix this by copying all the data in question at querystart, it seems better to just hold the relcache entry open for thewhole query.While at it, improve the handling of support-function lookups: do thatonce per query not once per pruning test. There's still something to bedesired here, in that we fail to exploit the possibility of caching dataacross queries in the fn_extra fields of the relcache's FmgrInfo structs,which could happen if we just used those structs in-place rather thancopying them. However, combining that with the possibility of per-querylookups of cross-type comparison functions seems to require changes in theAPIs of a lot of the pruning support functions, so it's too invasive toconsider as part of this patch. A win would ensue only for complexpartition key data types (e.g. arrays), so it may not be worth thetrouble.David Rowley and Tom LaneDiscussion:https://postgr.es/m/17850.1528755844@sss.pgh.pa.us1 parente146e4d commite23bae8
File tree
6 files changed
+132
-73
lines changed- src
- backend
- executor
- partitioning
- utils/cache
- include
- executor
- partitioning
6 files changed
+132
-73
lines changedLines changed: 45 additions & 18 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1357 | 1357 |
| |
1358 | 1358 |
| |
1359 | 1359 |
| |
1360 |
| - | |
| 1360 | + | |
1361 | 1361 |
| |
1362 | 1362 |
| |
1363 | 1363 |
| |
1364 | 1364 |
| |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
1365 | 1368 |
| |
1366 | 1369 |
| |
1367 | 1370 |
| |
| |||
1382 | 1385 |
| |
1383 | 1386 |
| |
1384 | 1387 |
| |
1385 |
| - | |
1386 |
| - | |
| 1388 | + | |
| 1389 | + | |
1387 | 1390 |
| |
1388 | 1391 |
| |
1389 | 1392 |
| |
| |||
1395 | 1398 |
| |
1396 | 1399 |
| |
1397 | 1400 |
| |
1398 |
| - | |
| 1401 | + | |
1399 | 1402 |
| |
1400 | 1403 |
| |
1401 | 1404 |
| |
| |||
1435 | 1438 |
| |
1436 | 1439 |
| |
1437 | 1440 |
| |
1438 |
| - | |
1439 | 1441 |
| |
1440 |
| - | |
1441 | 1442 |
| |
1442 | 1443 |
| |
| 1444 | + | |
1443 | 1445 |
| |
1444 | 1446 |
| |
1445 | 1447 |
| |
| |||
1456 | 1458 |
| |
1457 | 1459 |
| |
1458 | 1460 |
| |
1459 |
| - | |
1460 |
| - | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
1461 | 1466 |
| |
1462 |
| - | |
| 1467 | + | |
1463 | 1468 |
| |
1464 |
| - | |
1465 |
| - | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
1466 | 1472 |
| |
1467 | 1473 |
| |
1468 | 1474 |
| |
1469 |
| - | |
1470 |
| - | |
| 1475 | + | |
| 1476 | + | |
1471 | 1477 |
| |
1472 | 1478 |
| |
1473 |
| - | |
1474 |
| - | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
1475 | 1485 |
| |
1476 | 1486 |
| |
1477 | 1487 |
| |
1478 |
| - | |
1479 | 1488 |
| |
1480 | 1489 |
| |
1481 | 1490 |
| |
| |||
1527 | 1536 |
| |
1528 | 1537 |
| |
1529 | 1538 |
| |
1530 |
| - | |
1531 |
| - | |
1532 | 1539 |
| |
1533 | 1540 |
| |
1534 | 1541 |
| |
1535 | 1542 |
| |
1536 | 1543 |
| |
1537 | 1544 |
| |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
1538 | 1565 |
| |
1539 | 1566 |
| |
1540 | 1567 |
| |
|
Lines changed: 10 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
136 | 136 |
| |
137 | 137 |
| |
138 | 138 |
| |
139 |
| - | |
140 |
| - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
141 | 143 |
| |
142 | 144 |
| |
143 | 145 |
| |
| |||
178 | 180 |
| |
179 | 181 |
| |
180 | 182 |
| |
181 |
| - | |
182 |
| - | |
183 | 183 |
| |
184 | 184 |
| |
185 | 185 |
| |
| |||
330 | 330 |
| |
331 | 331 |
| |
332 | 332 |
| |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
333 | 339 |
| |
334 | 340 |
| |
335 | 341 |
| |
|
Lines changed: 34 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
436 | 436 |
| |
437 | 437 |
| |
438 | 438 |
| |
| 439 | + | |
439 | 440 |
| |
440 | 441 |
| |
441 |
| - | |
442 |
| - | |
443 |
| - | |
444 |
| - | |
445 | 442 |
| |
446 | 443 |
| |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
447 | 450 |
| |
448 | 451 |
| |
| 452 | + | |
449 | 453 |
| |
450 | 454 |
| |
451 | 455 |
| |
| |||
2809 | 2813 |
| |
2810 | 2814 |
| |
2811 | 2815 |
| |
2812 |
| - | |
| 2816 | + | |
| 2817 | + | |
2813 | 2818 |
| |
2814 | 2819 |
| |
2815 | 2820 |
| |
| |||
2844 | 2849 |
| |
2845 | 2850 |
| |
2846 | 2851 |
| |
2847 |
| - | |
2848 | 2852 |
| |
2849 | 2853 |
| |
2850 | 2854 |
| |
| |||
2873 | 2877 |
| |
2874 | 2878 |
| |
2875 | 2879 |
| |
2876 |
| - | |
2877 |
| - | |
2878 |
| - | |
2879 |
| - | |
2880 |
| - | |
| 2880 | + | |
2881 | 2881 |
| |
2882 | 2882 |
| |
2883 |
| - | |
2884 |
| - | |
2885 |
| - | |
2886 |
| - | |
2887 |
| - | |
2888 |
| - | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
| 2893 | + | |
| 2894 | + | |
| 2895 | + | |
| 2896 | + | |
| 2897 | + | |
| 2898 | + | |
2889 | 2899 |
| |
2890 | 2900 |
| |
2891 | 2901 |
| |
| |||
2896 | 2906 |
| |
2897 | 2907 |
| |
2898 | 2908 |
| |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
| 2915 | + | |
2899 | 2916 |
| |
2900 | 2917 |
| |
2901 | 2918 |
| |
|
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2471 | 2471 |
| |
2472 | 2472 |
| |
2473 | 2473 |
| |
| 2474 | + | |
2474 | 2475 |
| |
2475 | 2476 |
| |
2476 | 2477 |
| |
| |||
2515 | 2516 |
| |
2516 | 2517 |
| |
2517 | 2518 |
| |
2518 |
| - | |
| 2519 | + | |
2519 | 2520 |
| |
2520 | 2521 |
| |
2521 | 2522 |
| |
| |||
2529 | 2530 |
| |
2530 | 2531 |
| |
2531 | 2532 |
| |
2532 |
| - | |
| 2533 | + | |
2533 | 2534 |
| |
2534 | 2535 |
| |
2535 | 2536 |
| |
2536 | 2537 |
| |
2537 | 2538 |
| |
2538 |
| - | |
2539 | 2539 |
| |
2540 | 2540 |
| |
2541 | 2541 |
| |
|
Lines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
208 | 208 |
| |
209 | 209 |
| |
210 | 210 |
| |
211 |
| - | |
212 |
| - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
213 | 214 |
| |
214 | 215 |
| |
215 | 216 |
| |
|
Lines changed: 37 additions & 29 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
| 23 | + | |
| 24 | + | |
23 | 25 |
| |
24 |
| - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
25 | 50 |
| |
26 | 51 |
| |
27 | 52 |
| |
28 |
| - | |
| 53 | + | |
29 | 54 |
| |
30 | 55 |
| |
31 |
| - | |
32 |
| - | |
33 |
| - | |
34 |
| - | |
35 |
| - | |
36 |
| - | |
37 | 56 |
| |
38 |
| - | |
39 |
| - | |
40 | 57 |
| |
41 |
| - | |
42 |
| - | |
43 |
| - | |
44 |
| - | |
45 |
| - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
46 | 62 |
| |
47 |
| - | |
48 |
| - | |
49 |
| - | |
50 |
| - | |
51 |
| - | |
52 |
| - | |
53 | 63 |
| |
54 |
| - | |
55 |
| - | |
56 |
| - | |
57 |
| - | |
58 |
| - | |
59 |
| - | |
60 | 64 |
| |
61 |
| - | |
62 |
| - | |
63 | 65 |
| |
64 | 66 |
| |
65 | 67 |
| |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
66 | 74 |
| |
67 | 75 |
| |
68 | 76 |
| |
|
0 commit comments
Comments
(0)