Re: Cutting initdb's runtime (Perl question embedded)
Andreas Karlsson <andreas@proxel.se>
From: Andreas Karlsson <andreas@proxel.se>
To: Tom Lane <tgl@sss.pgh.pa.us>, Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@postgresql.org
Date: 2017-04-15T01:44:18Z
Lists: pgsql-hackers
On 04/14/2017 11:54 PM, Tom Lane wrote: > I failed to resist the temptation to poke at this, and found that > indeed nothing seems to break if we just use one transaction for the > whole processing of postgres.bki. So I've pushed a patch that does > that. We're definitely down to the point where worrying about the > speed of bootstrap mode, per se, is useless; the other steps in > initdb visibly take a lot more time. Looked some at this and what take time now for me seems to mainly be these four things (out of a total runtime of 560 ms). 1. setup_conversion: 140 ms 2. select_default_timezone: 90 ms 3. bootstrap_template1: 80 ms 4. setup_schema: 65 ms These four take up about two thirds of the total runtime, so it seems likely that we may still have relatively low hanging fruit (but not worth committing for PostgreSQL 10). I have not done profiling of these functions yet, so am not sure how they best would be fixed but maybe setup_conversion could be converted into bki entries to speed it up. Andreas
Commits
-
Attempt to identify system timezone by reading /etc/localtime symlink.
- 995b4fe0b14f 11.4 landed
- 8de574aa8bf7 10.9 landed
- 77dc741a1727 9.5.18 landed
- 75b0f21e1b19 9.6.14 landed
- 37011bcb30a9 9.4.23 landed
- 23bd3cec6eb1 12.0 landed
-
Make sure to run one initdb TAP test with no TZ set
- 033b969edde6 10.0 landed
-
Use one transaction while reading postgres.bki, not one per line.
- 85a0781334a2 10.0 landed
-
Move bootstrap-time lookup of regproc OIDs into genbki.pl.
- 5e39f06cfe65 10.0 landed