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 1vboim-00DoaZ-3C for pgsql-hackers@arkaria.postgresql.org; Fri, 02 Jan 2026 23:38:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vboil-00BVXS-37 for pgsql-hackers@arkaria.postgresql.org; Fri, 02 Jan 2026 23:38:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vboil-00BVXK-1n for pgsql-hackers@lists.postgresql.org; Fri, 02 Jan 2026 23:38:16 +0000 Received: from smtp.outgoing.loopia.se ([93.188.3.37]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vboij-0049lO-36 for pgsql-hackers@lists.postgresql.org; Fri, 02 Jan 2026 23:38:15 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id 7EF7C507830 for ; Sat, 03 Jan 2026 00:38:12 +0100 (CET) Received: from s981.loopia.se (unknown [172.22.191.5]) by s807.loopia.se (Postfix) with ESMTP id 63C70507BA5; Sat, 03 Jan 2026 00:38:12 +0100 (CET) Received: from localhost (unknown [172.22.191.5]) by s981.loopia.se (Postfix) with ESMTP id 619FF22B165B; Sat, 03 Jan 2026 00:38:12 +0100 (CET) X-Virus-Scanned: amavis at amavis.loopia.se X-Spam-Flag: NO X-Spam-Score: -1.2 X-Spam-Level: X-Spam-Status: No, score=-1.2 tagged_above=-999 required=6.2 tests=[ALL_TRUSTED=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1] autolearn=disabled Authentication-Results: s472.loopia.se (amavis); dkim=pass (2048-bit key) header.d=proxel.se Received: from s899.loopia.se ([172.22.191.5]) by localhost (s472.loopia.se [172.22.190.12]) (amavis, port 10024) with LMTP id PAkxX3dUBpD1; Sat, 3 Jan 2026 00:38:11 +0100 (CET) X-Loopia-Auth: user X-Loopia-User: andreas@proxel.se X-Loopia-Originating-IP: 147.28.75.140 Received: from [192.168.0.121] (customer-147-28-75-140.stosn.net [147.28.75.140]) (Authenticated sender: andreas@proxel.se) by s899.loopia.se (Postfix) with ESMTPSA id 839752C8B90F; Sat, 03 Jan 2026 00:38:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proxel.se; s=loopiadkim1707418970; t=1767397091; bh=bS9oVyoXkMJ4J8KXsgu0S7XdxGbuR8crXa+p+mWjFDI=; h=Date:Subject:To:References:From:In-Reply-To; b=PmWYQDTHjzsxr5HFkmxgmU4LDN1twiCe4gkRQMHCJqFATOA+xYe0qRBebACkOih+p akalV+Uysnmz6hETPGGHRx92n9Su5AOr6Dv3V1RBNUs+ajeN1GYYuDGmySwc8qgYa3 HyFhnq9CwKt9GfqnJM4Z4Rj4EqdXaRctiUduNmGQHk21BL3fddknV0rMm/yJFRUldv pvF4Db/kaEE4px64Phpz+hcvPGrne/yYoUWos2xL4tscFD31uyzAzt4IOehSb7RvXN notZ+Qj4msY+UFG5v3JjAmBdiqVbR7qbA3j9rPwpSGD6NKRc96vkwiAEHwMQC/R2k+ Ll8B+dpRA0VNg== Message-ID: Date: Sat, 3 Jan 2026 00:38:10 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Parallelizing startup with many databases To: Babak Ghadiri , pgsql-hackers@lists.postgresql.org References: From: Andreas Karlsson Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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. How slow are we talking about and have you managed to create a minimal case for reproducing the issue? > - Is the largely single-threaded startup behavior a fundamental > architectural >   constraint (e.g. catalog dependencies, locking, recovery ordering), > or mainly >   an unimplemented optimization? PostgreSQL does not support threading, it uses a multi-process model to implement for example parallel queries. And there is no way threading would be introduced just to improved startup performance. > - Are there any existing discussions, patches, versions (18+) to > parallelize parts of startup or otherwise improve startup scalability > with many databases? Not as far as I am aware but you can search our archives. > - Are there any PostgreSQL configuration settings known to dramatically > reduce startup time, or is startup performance mostly fixed by > architecture in this scenario? I would first start trying to figure out why startup is slow before doing anything else. Andreas