postgresql/src/bin/pg_dump
Tom Lane 9407dbbcb5 Cache the results of format_type() queries in pg_dump.
There's long been a "TODO: there might be some value in caching
the results" annotation on pg_dump's getFormattedTypeName function;
but we hadn't gotten around to checking what it was costing us to
repetitively look up type names.  It turns out that when dumping the
current regression database, about 10% of the total number of queries
issued are duplicative format_type() queries.  However, Hubert Depesz
Lubaczewski reported a not-unusual case where these account for over
half of the queries issued by pg_dump.  Individually these queries
aren't expensive, but when network lag is a factor, they add up to a
problem.  We can very easily add some caching to getFormattedTypeName
to solve it.

Since this is such a simple fix and can have a visible performance
benefit, back-patch to all supported branches.

Discussion: https://postgr.es/m/20210826084430.GA26282@depesz.com
2021-08-31 13:53:49 -04:00
..
po Translation updates 2021-08-09 11:51:59 +02:00
t Fix pg_dump for disabled triggers on partitioned tables 2021-07-16 17:29:22 -04:00
.gitignore Clean up after pg_dump test runs. 2016-05-06 22:28:01 -04:00
common.c Initial pgindent and pgperltidy run for v14. 2021-05-12 13:14:10 -04:00
compress_io.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
compress_io.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
dumputils.c Fix pg_dump for GRANT OPTION among initial privileges. 2021-01-16 12:21:35 -08:00
dumputils.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
Makefile Update copyright for 2021 2021-01-02 13:06:25 -05:00
nls.mk Translation updates 2021-05-10 14:36:21 +02:00
parallel.c Factor out system call names from error messages 2021-04-23 14:21:37 +02:00
parallel.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_backup.h Rethink definition of pg_attribute.attcompression. 2021-05-27 13:24:27 -04:00
pg_backup_archiver.c Work around portability issue with newer versions of mktime(). 2021-06-13 14:32:42 -04:00
pg_backup_archiver.h Initial pgindent and pgperltidy run for v14. 2021-05-12 13:14:10 -04:00
pg_backup_custom.c Yet more elimination of dead stores and useless initializations. 2020-09-05 13:17:32 -04:00
pg_backup_db.c Avoid redundantly prefixing PQerrorMessage for a connection failure. 2021-01-22 16:52:31 -05:00
pg_backup_db.h Revert "pg_dump: Lock all relations, not just plain tables". 2020-11-06 15:48:04 -05:00
pg_backup_directory.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_backup_null.c Remove useless "return;" lines 2019-11-28 16:48:37 -03:00
pg_backup_tar.c Initial pgindent and pgperltidy run for v14. 2021-05-12 13:14:10 -04:00
pg_backup_tar.h Fix tar files emitted by pg_dump and pg_basebackup to be POSIX conformant. 2012-09-28 15:19:15 -04:00
pg_backup_utils.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_backup_utils.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
pg_dump.c Cache the results of format_type() queries in pg_dump. 2021-08-31 13:53:49 -04:00
pg_dump.h Cache the results of format_type() queries in pg_dump. 2021-08-31 13:53:49 -04:00
pg_dump_sort.c Dump ALTER TABLE ... ATTACH PARTITION as a separate ArchiveEntry. 2021-01-11 21:09:18 -05:00
pg_dumpall.c Add --no-toast-compression to pg_dumpall 2021-05-19 09:38:48 +09:00
pg_restore.c Fix handling of -d "connection string" in pg_dump/pg_restore. 2020-09-24 18:19:38 -04:00