pgsql: Avoid some overhead with open and close of catalog indexes
От | Michael Paquier |
---|---|
Тема | pgsql: Avoid some overhead with open and close of catalog indexes |
Дата | |
Msg-id | E1ov7Zk-000O8a-9W@gemulon.postgresql.org обсуждение исходный текст |
Список | pgsql-committers |
Avoid some overhead with open and close of catalog indexes This commit improves two code paths to open and close indexes a minimum amount of times when doing a series of catalog updates or inserts. CatalogTupleInsert() is costly when using it for multiple inserts or updates compared to CatalogTupleInsertWithInfo(), as it would need to open and close the indexes of the catalog worked each time an operation is done. This commit updates the following places: - REINDEX CONCURRENTLY when copying statistics from one index relation to the other. Multi-INSERTs are avoided here, as this would begin to show benefits only for indexes with multiple expressions, for example, which may not be the most common pattern. This change is noticeable in profiles with indexes having many expressions, for example, and it would improve 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 one insertion and/or update is required, to minimize the cost of the operation. Like the previous coding, no indexes are opened as long as at least one insert or update of pg_statistic has happened. Author: Ranier Vilela Reviewed-by: Kyotaro Horiguchi, Michael Paquier Discussion: https://postgr.es/m/CAEudQAqh0F9y6Di_Wc8xW4zkWm_5SDd-nRfVsCn=h0Nm1C_mrg@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/09a72188cd5cdd179dc814c6729f8a3785b23c36 Modified Files -------------- src/backend/catalog/heap.c | 10 +++++++++- src/backend/commands/analyze.c | 11 +++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-)
В списке pgsql-committers по дате отправления: