diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2021-08-31 13:53:33 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2021-08-31 13:53:50 -0400 |
commit | 2f1ed9d98c38a62ffa4b0a6589c9fcc529ae0883 (patch) | |
tree | 30dba6d0503345d5e9cf4bcc00be52f29e81d4d1 /src/backend/commands/constraint.c | |
parent | 5f8dd5dc1701348bce659b9689d085e011399d61 (diff) | |
download | postgresql-2f1ed9d98c38a62ffa4b0a6589c9fcc529ae0883.tar.gz postgresql-2f1ed9d98c38a62ffa4b0a6589c9fcc529ae0883.zip |
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
Diffstat (limited to 'src/backend/commands/constraint.c')
0 files changed, 0 insertions, 0 deletions