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.94.2) (envelope-from ) id 1twKpX-00D0v0-J2 for pgsql-performance@arkaria.postgresql.org; Sun, 23 Mar 2025 12:53:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1twKpW-00Fl6t-AX for pgsql-performance@arkaria.postgresql.org; Sun, 23 Mar 2025 12:53:30 +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.94.2) (envelope-from ) id 1tvM1Z-007vCA-KD for pgsql-performance@lists.postgresql.org; Thu, 20 Mar 2025 19:57:53 +0000 Received: from mout.gmx.net ([212.227.15.18]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tvM1X-000CHU-17 for pgsql-performance@lists.postgresql.org; Thu, 20 Mar 2025 19:57:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1742500667; x=1743105467; i=jimis@gmx.net; bh=bwOk2CEvzGH+/8lo+MmoPABVPbICGcmy8CAysGpMNtM=; h=X-UI-Sender-Class:Date:From:To:cc:Subject:In-Reply-To:Message-ID: References:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=s7oGnpKFUHWMQr/kNucYEpI1qBlXe7dXLCdVESJcsm2jzSXYWp2MApwKIUkAIMKS 2T9r0VvAJAxM0nv/4nbM7waq4VIOPAtYlZPo85LPCT8BNL4xrX1Hbwwctq1l9G+FT /6SRTwu9ukv5JWcXIVAmP5f9oGZSOYFPAVBhqT2apKu+nvNXCIv45y37ajFXhCrWl QaA/SDbRuln/YU07f6o2jcq1ypELCGMAFYl6tCotdQcgZUiDaGj03hOKCeXFsV3x2 3RjLi7zhVQ8b2eQ7+6wNwZgaN2ONQi+XBlXr5GNzvFxyI21YkoRAv94PhX9+x/BFH W6zSys4bFcynB6IQ2Q== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [10.9.70.81] ([185.55.106.54]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MFsUv-1txEkm1Lvb-009OSu; Thu, 20 Mar 2025 20:57:47 +0100 Date: Thu, 20 Mar 2025 20:57:45 +0100 (CET) From: Dimitrios Apostolou To: Tom Lane cc: pgsql-performance@lists.postgresql.org Subject: Re: parallel pg_restore blocks on heavy random read I/O on all children processes In-Reply-To: <1095774.1742498237@sss.pgh.pa.us> Message-ID: References: <6bd16bdb-aa5e-0512-739d-b84100596035@gmx.net> <1095774.1742498237@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Provags-ID: V03:K1:E8kUIXrtWHMJTN8wkjaDV4C6KBTdKgWClkYZeZITvXhz9WisTgt wG3GcwNIGWlWBoUp11Noc01wAwVIWHiKA7LsqreRgWQU5AK0GoKY3lHlzkoMLt7br+BCBgZ mf7O8XaHXllyeqicI/2rG84jr/lfPq4Nqy4O9TiXWhmu/rLGkUgxc/xdBZ8TpxqekE1+F/i Le6Chq0YOxd1Xj/AAamvQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:SVFiuM1F1hc=;gbCgS712wTalyw3jsTAW75gcADM 2/qBaFPHHHTnjk4LrDuGB+6xr1yrEYftVE16Dbf8LZz6g+qUtXXfbZ+anxURRgoUbDzzZZsdk IMHJ5ZzUNaMzEep0BEhkC8+JjzX0Z4/e6qTvJFK9j/Hq1WPOgnqMlYyFoOxA4G5z5XPcjr2EI V/z3IWlFT9HAcfx1GKguKjfPP8IKOgMeX4+ETzH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l2yrZ2HcDKw9ey3xznad+Z2qNSVJj05T93gDQYcg4auPlY5d /vomWyELb13zHEcFkS9HCG2GloL5otXSgmi93oMt98WSP3wXHQb1I4sVSH16vFgFYrRNBvUNT bujd/teFBaULxMbHHtsNJS1GuBk3Pu4epQ8ZVIAqq+wkDl9x5uVRpNLkrwtZhkTqdR+25JYSZ JvhZsjFQf8IW+094PdHxdG4cvrGo= Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 20 Mar 2025, Tom Lane wrote: > I am betting that the problem is that the dump's TOC (table of > contents) lacks offsets to the actual data of the database objects, > and thus the readers have to reconstruct that information by scanning > the dump file. Normally, pg_dump will back-fill offset data in the > TOC at completion of the dump, but if it's told to write to an > un-seekable output file then it cannot do that. Thanks Tom, this makes sense! As you noticed, I'm piping the output, and this was a conscious choice. > I don't see an easy way, and certainly no way that wouldn't involve > redefining the archive format. Can you write the dump to a local > file rather than piping it immediately? Unfortunately I don't have enough space for that. I'm still testing, but the way this is designed to work is to take an uncompressed pg_dump (unlike the above which was compressed for testing purposes) and send it to a backup server having its own deduplication and compression. Further questions: * Does the same happen in an uncompressed dump? Or maybe the offsets are pre-filled because they are predictable without compression? * Should pg_dump print some warning for generating a lower quality format? * The seeking pattern in pg_restore seems non-sensical to me: reading 4K, jumping 8-12K, repeat for the whole file? Consuming 15K IOPS for an hour. /Maybe/ something to improve there... Where can I read more about the format? * Why doesn't it happen in single-process pg_restore? Thank you! Dimitris