public inbox for pgsql-docs@postgresql.org  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andreas Karlsson <andreas@proxel.se>
Cc: Babak Ghadiri <bbkghadiri6@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Parallelizing startup with many databases
Date: Fri, 02 Jan 2026 19:02:27 -0500
Message-ID: <290550.1767398547@sss.pgh.pa.us> (raw)
In-Reply-To: <eed28e65-d978-400d-ba6e-83cef0d2c6b7@proxel.se>
References: <CAEkHFKSxYO7Ryv_UNNGSe88zosg0_Q_dop6hXN0oCoYK28EZtA@mail.gmail.com>
	<eed28e65-d978-400d-ba6e-83cef0d2c6b7@proxel.se>

Andreas Karlsson <andreas@proxel.se> writes:
> On 1/2/26 8:55 AM, Babak Ghadiri wrote:
>> In PostgreSQL 16, startup appears to initialize databases sequentially and
>> primarily uses a single CPU core. In clusters with a very large number of
>> databases (around 5,000 in our case), this results in noticeably long
>> startup times after restarts or crash recovery.

> Have you measured what is actually causing the slow startup? Without 
> knowing what is actually slow it is hard to say if threading would even 
> help.

"perf" results would likely be useful.

I tried creating 5000 databases here and didn't notice any particular
increase in server startup time (didn't try crash-recovery case).
So whatever this is is likely somewhat configuration- or
platform-dependent.

Having said that, 5000 databases sounds like an anti-pattern to
begin with.  You're paying for an additional copy of the system
catalogs for each one.

			regards, tom lane





reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, andreas@proxel.se, bbkghadiri6@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Parallelizing startup with many databases
  In-Reply-To: <290550.1767398547@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox