forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit2000b6c
committed
Don't fetch partition check expression during InitResultRelInfo.
Since there is only one place that actually needs the partition checkexpression, namely ExecPartitionCheck, it's better to fetch it fromthe relcache there. In this way we will never fetch it at all ifthe query never has use for it, and we still fetch it just once whenwe do need it.The reason for taking an interest in this is that if the relcachedoesn't already have the check expression cached, fetching itrequires obtaining AccessShareLock on the partition root. Thatmeans that operations that look like they should only touch thepartition itself will also take a lock on the root. In particularwe observed that TRUNCATE on a partition may take a lock on thepartition's root, contributing to a deadlock situation in parallelpg_restore.As written, this patch does have a small cost, which is that weare microscopically reducing efficiency for the case where a partitionhas an empty check expression. ExecPartitionCheck will be called,and will go through the motions of setting up and checking an emptyqual, where before it would not have been called at all. We couldavoid that by adding a separate boolean flag to track whether thereis a partition expression to test. However, this case only arisesfor a default partition with no siblings, which surely is not aninteresting case in practice. Hence adding complexity for itdoes not seem like a good trade-off.Amit Langote, per a suggestion by meDiscussion:https://postgr.es/m/VI1PR03MB31670CA1BD9625C3A8C5DD05EB230@VI1PR03MB3167.eurprd03.prod.outlook.com1 parentaac80bf commit2000b6c
File tree
7 files changed
+26
-40
lines changed- src
- backend
- commands
- executor
- replication/logical
- include/nodes
7 files changed
+26
-40
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3236 | 3236 |
| |
3237 | 3237 |
| |
3238 | 3238 |
| |
3239 |
| - | |
| 3239 | + | |
3240 | 3240 |
| |
3241 | 3241 |
| |
3242 | 3242 |
| |
|
Lines changed: 15 additions & 26 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1280 | 1280 |
| |
1281 | 1281 |
| |
1282 | 1282 |
| |
1283 |
| - | |
1284 |
| - | |
1285 | 1283 |
| |
1286 | 1284 |
| |
1287 | 1285 |
| |
| |||
1325 | 1323 |
| |
1326 | 1324 |
| |
1327 | 1325 |
| |
1328 |
| - | |
1329 |
| - | |
1330 |
| - | |
1331 |
| - | |
1332 |
| - | |
1333 |
| - | |
1334 |
| - | |
1335 |
| - | |
1336 |
| - | |
1337 |
| - | |
1338 |
| - | |
1339 |
| - | |
1340 |
| - | |
1341 |
| - | |
1342 |
| - | |
1343 |
| - | |
1344 |
| - | |
1345 | 1326 |
| |
1346 | 1327 |
| |
1347 | 1328 |
| |
| |||
1776 | 1757 |
| |
1777 | 1758 |
| |
1778 | 1759 |
| |
1779 |
| - | |
| 1760 | + | |
1780 | 1761 |
| |
1781 | 1762 |
| |
1782 | 1763 |
| |
| |||
1788 | 1769 |
| |
1789 | 1770 |
| |
1790 | 1771 |
| |
1791 |
| - | |
1792 |
| - | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
1793 | 1776 |
| |
1794 | 1777 |
| |
1795 | 1778 |
| |
1796 |
| - | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
1797 | 1785 |
| |
1798 | 1786 |
| |
| 1787 | + | |
1799 | 1788 |
| |
1800 | 1789 |
| |
1801 | 1790 |
| |
| |||
1904 | 1893 |
| |
1905 | 1894 |
| |
1906 | 1895 |
| |
1907 |
| - | |
| 1896 | + | |
1908 | 1897 |
| |
1909 |
| - | |
| 1898 | + | |
1910 | 1899 |
| |
1911 | 1900 |
| |
1912 | 1901 |
| |
| |||
1967 | 1956 |
| |
1968 | 1957 |
| |
1969 | 1958 |
| |
1970 |
| - | |
| 1959 | + | |
1971 | 1960 |
| |
1972 | 1961 |
| |
1973 | 1962 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
299 | 299 |
| |
300 | 300 |
| |
301 | 301 |
| |
302 |
| - | |
| 302 | + | |
303 | 303 |
| |
304 | 304 |
| |
305 | 305 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
435 | 435 |
| |
436 | 436 |
| |
437 | 437 |
| |
438 |
| - | |
| 438 | + | |
439 | 439 |
| |
440 | 440 |
| |
441 | 441 |
| |
| |||
501 | 501 |
| |
502 | 502 |
| |
503 | 503 |
| |
504 |
| - | |
| 504 | + | |
505 | 505 |
| |
506 | 506 |
| |
507 | 507 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
491 | 491 |
| |
492 | 492 |
| |
493 | 493 |
| |
494 |
| - | |
| 494 | + | |
495 | 495 |
| |
496 | 496 |
| |
497 | 497 |
| |
| |||
1181 | 1181 |
| |
1182 | 1182 |
| |
1183 | 1183 |
| |
1184 |
| - | |
| 1184 | + | |
1185 | 1185 |
| |
1186 | 1186 |
| |
1187 | 1187 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1676 | 1676 |
| |
1677 | 1677 |
| |
1678 | 1678 |
| |
1679 |
| - | |
| 1679 | + | |
1680 | 1680 |
| |
1681 | 1681 |
| |
1682 | 1682 |
| |
|
Lines changed: 4 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
477 | 477 |
| |
478 | 478 |
| |
479 | 479 |
| |
480 |
| - | |
481 |
| - | |
482 |
| - | |
483 |
| - | |
| 480 | + | |
484 | 481 |
| |
485 | 482 |
| |
486 |
| - | |
| 483 | + | |
487 | 484 |
| |
488 | 485 |
| |
489 |
| - | |
| 486 | + | |
490 | 487 |
| |
491 | 488 |
| |
492 |
| - | |
| 489 | + | |
493 | 490 |
| |
494 | 491 |
| |
495 | 492 |
| |
|
0 commit comments
Comments
(0)