forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit9407dbb
committed
Cache the results of format_type() queries in pg_dump.
There's long been a "TODO: there might be some value in cachingthe results" annotation on pg_dump's getFormattedTypeName function;but we hadn't gotten around to checking what it was costing us torepetitively look up type names. It turns out that when dumping thecurrent regression database, about 10% of the total number of queriesissued are duplicative format_type() queries. However, Hubert DepeszLubaczewski reported a not-unusual case where these account for overhalf of the queries issued by pg_dump. Individually these queriesaren't expensive, but when network lag is a factor, they add up to aproblem. We can very easily add some caching to getFormattedTypeNameto solve it.Since this is such a simple fix and can have a visible performancebenefit, back-patch to all supported branches.Discussion:https://postgr.es/m/20210826084430.GA26282@depesz.com1 parent4090ff2 commit9407dbb
2 files changed
+15
-4
lines changedLines changed: 11 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5206 | 5206 |
| |
5207 | 5207 |
| |
5208 | 5208 |
| |
| 5209 | + | |
5209 | 5210 |
| |
5210 | 5211 |
| |
5211 | 5212 |
| |
| |||
18761 | 18762 |
| |
18762 | 18763 |
| |
18763 | 18764 |
| |
18764 |
| - | |
18765 |
| - | |
18766 | 18765 |
| |
18767 | 18766 |
| |
18768 | 18767 |
| |
18769 | 18768 |
| |
| 18769 | + | |
18770 | 18770 |
| |
18771 | 18771 |
| |
18772 | 18772 |
| |
| |||
18779 | 18779 |
| |
18780 | 18780 |
| |
18781 | 18781 |
| |
| 18782 | + | |
| 18783 | + | |
| 18784 | + | |
| 18785 | + | |
| 18786 | + | |
18782 | 18787 |
| |
18783 | 18788 |
| |
18784 | 18789 |
| |
| |||
18791 | 18796 |
| |
18792 | 18797 |
| |
18793 | 18798 |
| |
| 18799 | + | |
| 18800 | + | |
| 18801 | + | |
| 18802 | + | |
18794 | 18803 |
| |
18795 | 18804 |
| |
18796 | 18805 |
| |
|
Lines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
164 | 164 |
| |
165 | 165 |
| |
166 | 166 |
| |
167 |
| - | |
168 |
| - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
169 | 170 |
| |
| 171 | + | |
170 | 172 |
| |
171 | 173 |
| |
172 | 174 |
| |
|
0 commit comments
Comments
(0)