pgsql: Reduce number of commands dumpTableSchema emits for binary upgra
От | Tom Lane |
---|---|
Тема | pgsql: Reduce number of commands dumpTableSchema emits for binary upgra |
Дата | |
Msg-id | E1sYT42-001lYa-B1@gemulon.postgresql.org обсуждение исходный текст |
Список | pgsql-committers |
Reduce number of commands dumpTableSchema emits for binary upgrade. Avoid issuing a separate SQL UPDATE command for each column when directly manipulating pg_attribute contents in binary upgrade mode. With the separate updates, we triggered a relcache invalidation with each update. For a table with N columns, that causes O(N^2) relcache bloat in txn_size mode because the table's newly-created relcache entry can't be flushed till end of transaction. Reducing the number of commands should make it marginally faster as well as avoiding that problem. While at it, likewise avoid issuing a separate UPDATE on pg_constraint for each inherited constraint. This is less exciting, first because inherited (non-partitioned) constraints are relatively rare, and second because the backend has a good deal of trouble anyway with restoring tables containing many such constraints, due to MergeConstraintsIntoExisting being horribly inefficient. But it seems more consistent to do it this way here too, and it surely can't hurt. In passing, fix one place in dumpTableSchema that failed to use ONLY in ALTER TABLE. That's not a live bug, but it's inconsistent. Also avoid silently casting away const from string literals. Per report from Justin Pryzby. Back-patch to v17 where txn_size mode was introduced. Discussion: https://postgr.es/m/ZqEND4ZcTDBmcv31@pryzbyj2023 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/b3f0e0503f333938df638a8f499909ce4901b40c Modified Files -------------- src/bin/pg_dump/pg_dump.c | 134 ++++++++++++++++++++++++++++----------- src/bin/pg_dump/t/002_pg_dump.pl | 2 +- 2 files changed, 99 insertions(+), 37 deletions(-)
В списке pgsql-committers по дате отправления: