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 1vJcEU-00DEvc-1I for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Nov 2025 18:39:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vJcER-0034R5-1Q for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Nov 2025 18:39:43 +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 1vJcER-0034Qx-0T for pgsql-hackers@lists.postgresql.org; Thu, 13 Nov 2025 18:39:43 +0000 Received: from mail-qt1-x82f.google.com ([2607:f8b0:4864:20::82f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vJcEO-007aX6-2u for pgsql-hackers@lists.postgresql.org; Thu, 13 Nov 2025 18:39:42 +0000 Received: by mail-qt1-x82f.google.com with SMTP id d75a77b69052e-4ede12521d4so25481cf.1 for ; Thu, 13 Nov 2025 10:39:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1763059179; x=1763663979; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=yuy19toLYdgnmqiTTgsAX6tH7mshnxnRCPfR4hnMgJ4=; b=x7rxmpvTK1Sh1DVbV5rnSXZ6cIi+41NgtpHJFQoMPZ4dQ25AwK2ygEHT4xcpaaRrxN vnd/CclJha05/0ya2vAUpMCgdJ5Qf0bDwUbqo8TawTsJLR+uO91KBol0q6jc3UyqaxQr ofz70RGZ5uax8unDx7aYFWb2MrOUWNXEX+X9+tAt5iGbDIkOhco7KgtsjPBS/3iW+Nvz InIXinOqzMcteRUIH9+l7Jd1W7c+QFG+6B7SJRo9pK9jDKWF7jNQnwSFY1jpOsgVVhZq Y/DlwuqsHgPzMXZYp7I56OeNqoiaFoR4sNiMaBpzXvrzTj9Q5htQYh0GgQzogTD+J9KJ ys+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763059179; x=1763663979; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=yuy19toLYdgnmqiTTgsAX6tH7mshnxnRCPfR4hnMgJ4=; b=avqDpRvGWse7+WJB2D1ggsKqUIAXV5/GL3gXLGQcab4Exp+JTn6xruCyj/2MPLqti4 lAQp7/mFAzWdp0xawCOWMJ/7AMsEVU7qcQQmY1w7JORkzEc2426FXdOGtowl6YounAXT OjA7X+yHPih8H7vY3LXDBzLUy1JIznkTtnO7ZRjR/7CrxjSZ5X5nfpgBFrWcNu0chsx0 GCxXsUhsR4COar3BCVywqbBHFSmV69oUgmyHv7kUKaazPMeEQdwiMoFFoMgV2ySSTe8a QRb610vUdQrluTEykgElFUUJqYdURD5sn/Z/Ms3RyjWaZrjFvvAQn+y8VnoOolYorihZ xs3w== X-Gm-Message-State: AOJu0YwDHV0fw3UKzpV4oU50DTN/udwJtTgqr60Bx4UCmHWTTH8WntII DDSBNjE0VwaTDICtARv22lq5WRewJEZMfdc+mcWUqSwPrLb8kT1ywM4xFy3juxO5S8wbXC+5DtR J6DEZZEJEzJXMWlRpnmDT7jZvLYEGTB4J3WlYL0wB X-Gm-Gg: ASbGnctL8bn1NII7Y7jlDxmt+Y5jd3BhHdjy7h3fQkLf2wWcWkqRPtumYDmRm+K1/2Q Kjs/AJuHvUeXwY4Y7IrIFEh2rN4Hl3jGt0XnnU8pDzMGMR1seYHn1UI2cnv/HkA3LOHQdLWgOKB Wt/dy5AiUTvRguMkJgBJgih//PBiOBeHQKucZTB9Y6OnIcN6EeQfJAbDi6NgjxKCAZ+L9ZH9eoJ G7pb7pHJOV3uewjAwBaevNMduL9b3KtU4gx9OODrygRCs34KBc2h80vDLyItt5D7Bo3iVGoymZk vr5r X-Google-Smtp-Source: AGHT+IE6Qi4AwOjtfJk0Ot0VxULxx+VT6B+lR+4oQOTal2+7+6VfrMy+JRwFAP3vKTmYMq8I4eyK6jtr9Fjsz4rj5Lw= X-Received: by 2002:a05:622a:1aa8:b0:4b7:9617:4b51 with SMTP id d75a77b69052e-4edf3372f3cmr183241cf.15.1763059178346; Thu, 13 Nov 2025 10:39:38 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Hannu Krosing Date: Thu, 13 Nov 2025 19:39:26 +0100 X-Gm-Features: AWmQ_bkoGcgO06y7lEPOac1XTJreK-LOfNBY1WEFY0ymBstpLsZlU0opdVL0VuQ Message-ID: Subject: Re: Patch: dumping tables data in multiple chunks in pg_dump To: Ashutosh Bapat Cc: PostgreSQL Hackers , Nathan Bossart Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Going up to 16 workers did not improve performance , but this is expected, as the disk behind the database can only do 4TB/hour of reads, which is now the bottleneck. (408/352/*3600 =3D 4172 GB/h) $ time ./pg_dump --format=3Ddirectory -h 10.58.80.2 -U postgres --huge-table-chunk-pages=3D131072 -j 16 -f /tmp/parallel16.dump largedb real 5m44.900s user 53m50.491s sys 5m47.602s And 4 workers showed near-linear speedup from single worker hannuk@pgn2:~/work/postgres/src/bin/pg_dump$ time ./pg_dump --format=3Ddirectory -h 10.58.80.2 -U postgres --huge-table-chunk-pages=3D131072 -j 4 -f /tmp/parallel4.dump largedb real 10m32.074s user 38m54.436s sys 2m58.216s The database runs on a 64vCPU VM with 128GB RAM, so most of the table will be read in from the disk On Thu, Nov 13, 2025 at 7:02=E2=80=AFPM Hannu Krosing w= rote: > > I just ran a test by generating a 408GB table and then dumping it both wa= ys > > $ time pg_dump --format=3Ddirectory -h 10.58.80.2 -U postgres -f > /tmp/plain.dump largedb > > real 39m54.968s > user 37m21.557s > sys 2m32.422s > > $ time ./pg_dump --format=3Ddirectory -h 10.58.80.2 -U postgres > --huge-table-chunk-pages=3D131072 -j 8 -f /tmp/parallel8.dump largedb > > real 5m52.965s > user 40m27.284s > sys 3m53.339s > > So parallel dump with 8 workers using 1GB (128k pages) chunks runs > almost 7 times faster than the sequential dump. > > this was a table that had no TOAST part. I will run some more tests > with TOASTed tables next and expect similar or better improvements. > > > > On Wed, Nov 12, 2025 at 1:59=E2=80=AFPM Ashutosh Bapat > wrote: > > > > Hi Hannu, > > > > On Tue, Nov 11, 2025 at 9:00=E2=80=AFPM Hannu Krosing wrote: > > > > > > Attached is a patch that adds the ability to dump table data in multi= ple chunks. > > > > > > Looking for feedback at this point: > > > 1) what have I missed > > > 2) should I implement something to avoid single-page chunks > > > > > > The flag --huge-table-chunk-pages which tells the directory format > > > dump to dump tables where the main fork has more pages than this in > > > multiple chunks of given number of pages, > > > > > > The main use case is speeding up parallel dumps in case of one or a > > > small number of HUGE tables so parts of these can be dumped in > > > parallel. > > > > Have you measured speed up? Can you please share the numbers? > > > > -- > > Best Wishes, > > Ashutosh Bapat