Re: initdb / bootstrap design

From: Andres Freund <andres(at)anarazel(dot)de>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: initdb / bootstrap design
Date: 2022-02-16 17:53:58
Message-ID: 20220216175358.qh4aywk3cztbizgs@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2022-02-16 11:47:31 +0100, Peter Eisentraut wrote:
> On 16.02.22 03:12, Andres Freund wrote:
> > Sure, there's a few tokens that we replace in initdb. As it turns out there's
> > only two rows that are actually variable. The username of the initial
> > superuser in pg_authid and the pg_database row for template 1, where encoding,
> > lc_collate and lc_ctype varies. The rest is all compile time constant
> > replacements we could do as part of genbki.pl.
> >
> > It seems we could save a good number of context switches by opening
> > postgres.bki just before boot_yyparse() in BootstrapModeMain() and having the
> > parser read it. The pg_authid / pg_database rows we could just do via
> > explicit insertions in BootstrapModeMain(), provided by commandline args?
>
> I think we could do the locale setup by updating the pg_database row of
> template1 after bootstrap, as in the attached patch.

Another solution could be to have bootstrap create template0 instead of
template1. I think for template0 it'd more accurate to have a hardcoded C
collation and ascii encoding (which I don't think we actually have?).

> I suspect we could do the treatment of pg_authid similarly.

Yea.

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-02-16 17:56:42 Re: do only critical work during single-user vacuum?
Previous Message Peter Geoghegan 2022-02-16 17:50:41 Re: do only critical work during single-user vacuum?