Commit b416691
committed
Improve the performance of relation deletes during recovery.
When multiple relations are deleted at the same transaction,
the files of those relations are deleted by one call to smgrdounlinkall(),
which leads to scan whole shared_buffers only one time. OTOH,
previously, during recovery, smgrdounlink() (not smgrdounlinkall()) was
called for each file to delete, which led to scan shared_buffers
multiple times. Obviously this could cause to increase the WAL replay
time very much especially when shared_buffers was huge.
To alleviate this situation, this commit changes the recovery so that
it also calls smgrdounlinkall() only one time to delete multiple
relation files.
This is just fix for oversight of commit 279628a, not new feature.
So, per discussion on pgsql-hackers, we concluded to backpatch this
to all supported versions.
Author: Fujii Masao
Reviewed-by: Michael Paquier, Andres Freund, Thomas Munro, Kyotaro Horiguchi, Takayuki Tsunakawa
Discussion: https://postgr.es/m/CAHGQGwHVQkdfDqtvGVkty+19cQakAydXn1etGND3X0PHbZ3+6w@mail.gmail.com1 parent b46727e commit b416691
File tree
4 files changed
+44
-29
lines changed- src
- backend
- access/transam
- storage/smgr
- include/storage
4 files changed
+44
-29
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1456 | 1456 | | |
1457 | 1457 | | |
1458 | 1458 | | |
1459 | | - | |
1460 | 1459 | | |
1461 | 1460 | | |
1462 | 1461 | | |
| |||
1549 | 1548 | | |
1550 | 1549 | | |
1551 | 1550 | | |
1552 | | - | |
1553 | | - | |
1554 | | - | |
1555 | 1551 | | |
1556 | | - | |
1557 | | - | |
1558 | | - | |
| 1552 | + | |
| 1553 | + | |
1559 | 1554 | | |
1560 | 1555 | | |
1561 | 1556 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5516 | 5516 | | |
5517 | 5517 | | |
5518 | 5518 | | |
5519 | | - | |
5520 | 5519 | | |
5521 | 5520 | | |
5522 | 5521 | | |
| |||
5635 | 5634 | | |
5636 | 5635 | | |
5637 | 5636 | | |
5638 | | - | |
5639 | | - | |
5640 | | - | |
5641 | | - | |
5642 | | - | |
5643 | | - | |
5644 | | - | |
5645 | | - | |
5646 | | - | |
5647 | | - | |
| 5637 | + | |
| 5638 | + | |
5648 | 5639 | | |
5649 | 5640 | | |
5650 | 5641 | | |
| |||
5683 | 5674 | | |
5684 | 5675 | | |
5685 | 5676 | | |
5686 | | - | |
5687 | 5677 | | |
5688 | 5678 | | |
5689 | 5679 | | |
| |||
5748 | 5738 | | |
5749 | 5739 | | |
5750 | 5740 | | |
5751 | | - | |
5752 | | - | |
5753 | | - | |
5754 | | - | |
5755 | | - | |
5756 | | - | |
5757 | | - | |
5758 | | - | |
5759 | | - | |
5760 | | - | |
| 5741 | + | |
5761 | 5742 | | |
5762 | 5743 | | |
5763 | 5744 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
1703 | 1704 | | |
1704 | 1705 | | |
1705 | 1706 | | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
1706 | 1744 | | |
1707 | 1745 | | |
1708 | 1746 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| 146 | + | |
146 | 147 | | |
147 | 148 | | |
0 commit comments