forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit09a7218
committed
Avoid some overhead with open and close of catalog indexes
This commit improves two code paths to open and close indexes aminimum amount of times when doing a series of catalog updates orinserts. CatalogTupleInsert() is costly when using it for multipleinserts or updates compared to CatalogTupleInsertWithInfo(), as it wouldneed to open and close the indexes of the catalog worked each time anoperation is done.This commit updates the following places:- REINDEX CONCURRENTLY when copying statistics from one index relationto the other. Multi-INSERTs are avoided here, as this would begin toshow benefits only for indexes with multiple expressions, for example,which may not be the most common pattern. This change is noticeable inprofiles with indexes having many expressions, for example, and it wouldimprove any callers of CopyStatistics().- Update of statistics on ANALYZE, that mixes inserts and updates.In each case, the catalog indexes are opened only if at least oneinsertion and/or update is required, to minimize the cost of theoperation. Like the previous coding, no indexes are opened as long asat least one insert or update of pg_statistic has happened.Author: Ranier VilelaReviewed-by: Kyotaro Horiguchi, Michael PaquierDiscussion:https://postgr.es/m/CAEudQAqh0F9y6Di_Wc8xW4zkWm_5SDd-nRfVsCn=h0Nm1C_mrg@mail.gmail.com1 parent006b69f commit09a7218
2 files changed
+18
-3
lines changedLines changed: 9 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2856 | 2856 |
| |
2857 | 2857 |
| |
2858 | 2858 |
| |
| 2859 | + | |
2859 | 2860 |
| |
2860 | 2861 |
| |
2861 | 2862 |
| |
| |||
2878 | 2879 |
| |
2879 | 2880 |
| |
2880 | 2881 |
| |
2881 |
| - | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
2882 | 2888 |
| |
2883 | 2889 |
| |
2884 | 2890 |
| |
2885 | 2891 |
| |
2886 | 2892 |
| |
2887 | 2893 |
| |
| 2894 | + | |
| 2895 | + | |
2888 | 2896 |
| |
2889 | 2897 |
| |
2890 | 2898 |
| |
|
Lines changed: 9 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1624 | 1624 |
| |
1625 | 1625 |
| |
1626 | 1626 |
| |
| 1627 | + | |
1627 | 1628 |
| |
1628 | 1629 |
| |
1629 | 1630 |
| |
| |||
1725 | 1726 |
| |
1726 | 1727 |
| |
1727 | 1728 |
| |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
1728 | 1733 |
| |
1729 | 1734 |
| |
1730 | 1735 |
| |
| |||
1734 | 1739 |
| |
1735 | 1740 |
| |
1736 | 1741 |
| |
1737 |
| - | |
| 1742 | + | |
1738 | 1743 |
| |
1739 | 1744 |
| |
1740 | 1745 |
| |
1741 | 1746 |
| |
1742 | 1747 |
| |
1743 |
| - | |
| 1748 | + | |
1744 | 1749 |
| |
1745 | 1750 |
| |
1746 | 1751 |
| |
1747 | 1752 |
| |
1748 | 1753 |
| |
| 1754 | + | |
| 1755 | + | |
1749 | 1756 |
| |
1750 | 1757 |
| |
1751 | 1758 |
| |
|
0 commit comments
Comments
(0)