Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vbp6G-00DxXo-1u for pgsql-hackers@arkaria.postgresql.org; Sat, 03 Jan 2026 00:02:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vbp6F-00BXn9-0o for pgsql-hackers@arkaria.postgresql.org; Sat, 03 Jan 2026 00:02:32 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vbp6E-00BXn1-36 for pgsql-hackers@lists.postgresql.org; Sat, 03 Jan 2026 00:02:31 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vbp6E-003tG2-0o for pgsql-hackers@lists.postgresql.org; Sat, 03 Jan 2026 00:02:30 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 60302RmJ290551; Fri, 2 Jan 2026 19:02:27 -0500 From: Tom Lane To: Andreas Karlsson cc: Babak Ghadiri , pgsql-hackers@lists.postgresql.org Subject: Re: Parallelizing startup with many databases In-reply-to: References: Comments: In-reply-to Andreas Karlsson message dated "Sat, 03 Jan 2026 00:38:10 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <290549.1767398547.1@sss.pgh.pa.us> Date: Fri, 02 Jan 2026 19:02:27 -0500 Message-ID: <290550.1767398547@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andreas Karlsson 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