forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit904ce45
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 parentc8213aa commit904ce45
2 files changed
+15
-4
lines changedLines changed: 11 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5067 | 5067 |
| |
5068 | 5068 |
| |
5069 | 5069 |
| |
| 5070 | + | |
5070 | 5071 |
| |
5071 | 5072 |
| |
5072 | 5073 |
| |
| |||
18735 | 18736 |
| |
18736 | 18737 |
| |
18737 | 18738 |
| |
18738 |
| - | |
18739 |
| - | |
18740 | 18739 |
| |
18741 | 18740 |
| |
18742 | 18741 |
| |
18743 | 18742 |
| |
| 18743 | + | |
18744 | 18744 |
| |
18745 | 18745 |
| |
18746 | 18746 |
| |
| |||
18753 | 18753 |
| |
18754 | 18754 |
| |
18755 | 18755 |
| |
| 18756 | + | |
| 18757 | + | |
| 18758 | + | |
| 18759 | + | |
| 18760 | + | |
18756 | 18761 |
| |
18757 | 18762 |
| |
18758 | 18763 |
| |
| |||
18765 | 18770 |
| |
18766 | 18771 |
| |
18767 | 18772 |
| |
| 18773 | + | |
| 18774 | + | |
| 18775 | + | |
| 18776 | + | |
18768 | 18777 |
| |
18769 | 18778 |
| |
18770 | 18779 |
| |
|
Lines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
163 | 163 |
| |
164 | 164 |
| |
165 | 165 |
| |
166 |
| - | |
167 |
| - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
168 | 169 |
| |
| 170 | + | |
169 | 171 |
| |
170 | 172 |
| |
171 | 173 |
| |
|
0 commit comments
Comments
(0)