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 1vhlU4-005ls8-0A for pgsql-hackers@arkaria.postgresql.org; Mon, 19 Jan 2026 09:23:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vhlU3-00CM96-0G for pgsql-hackers@arkaria.postgresql.org; Mon, 19 Jan 2026 09:23:39 +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 1vhlU2-00CM8y-27 for pgsql-hackers@lists.postgresql.org; Mon, 19 Jan 2026 09:23:39 +0000 Received: from mail-dy1-x1343.google.com ([2607:f8b0:4864:20::1343]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vhlU0-001DP5-1L for pgsql-hackers@lists.postgresql.org; Mon, 19 Jan 2026 09:23:38 +0000 Received: by mail-dy1-x1343.google.com with SMTP id 5a478bee46e88-2b1981ca515so4371709eec.1 for ; Mon, 19 Jan 2026 01:23:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1768814616; cv=none; d=google.com; s=arc-20240605; b=JGCg9Gw2xHwdrm9Z3895UekjVQCgSejZ+cCBWD8Kah0oBCYB0SGFwJvYph3nQeXZ3z 7OMQF4jK2MlUFMDACQZnC7X6/g0QPIUPDRopx0e44fTS/Xz9Yr6omhK7V+xtYDAKz2H7 v4pPnH2jSb+U/NKVe2pppdYpCHsNlOatwz6cWX90eiDlyJXQldDodG86MYaUPz3B8D/3 NpxBTIIU+Gj0bgT0E3cUTMgcJLj/8kC+LUABuDBUUT+BBSIW6hAmrCpVf4r3C1E+Zznf zrjSecschoP4YFdkYFYhzyCeYBPZxno3sPswGNDF5hNN1YEiEPhsKnfcK5aiGWLk4s/s wB+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=8ofDbiVCxvSRSE7mXHa+0UUek6Jb1hltxjqKjPUuDDM=; fh=LmAMnXeVw0l7Fca1FMzr9xrvOyzL2n1P2gHSOl7pSYA=; b=M3BcVX5V23MxU9PvvoQurikLLEj9GNJXu/EnOX1UiuDV5q0c+HboLu+byKkasH1HdN A5MXlSVEIRitxAaOLn0s5lhFZ/3kWSLggrgIZ5BXXhDjyZW5tekT/Y65iqnVBGjcqwlz uhojdHiRTIU5SjSPkKjHhDFElPZLBkqBpqVH3GcO5AtYGTilJyiZenRcyw/z+WKJ4BJL WHaQsc9LUJF8KQe7u98PHAQ6RAibvrWP8jcfIy7vQk2PtBbzVnmSb6/LsLUd2ohvz4CC cdrnEi7SIgo6cpMwfllkM61en7rj0zbiruVD1SUTyqIekk1LTx+jZu+UtfXFfTJUlmtv V30g==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768814616; x=1769419416; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=8ofDbiVCxvSRSE7mXHa+0UUek6Jb1hltxjqKjPUuDDM=; b=T2t4qoqguS/X+QCAMvBknZ10GsMta5BD2lp7UQKCuEoqGzzn7oHGsLWYlNd4WTnVdl aK/FQX2XB0bwo29Bn/MjzIl1F4Zp2CuyRX+Wc+IpdLDdAnXSNJiRrCiVy+NJl6/fiweN sAGu1gPKoaGf1p0LPppdm2T4y76t/P02EyXSCkDfkCsALQjLxAOgbR/F/Lw4iv+Q7Vf1 WGUtBHS6tFEuDzeWDpDTf7dTm/EIIpfpAoJFAKbTGuHhzQhqYfBEGgDtoboxOq71cLKA +F6A45nNhjpK7MQigD7dwpGJrS3Sb13JA+/vmmlZRKHsuPoBatwU95HkkSXGEEFo/JaI Twsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768814616; x=1769419416; h=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=8ofDbiVCxvSRSE7mXHa+0UUek6Jb1hltxjqKjPUuDDM=; b=CX4e8erJyOettc5de98xai7HsHFo/JgUc5b9ot+32zE/hQuu7qO7t44mP5+TK0wVjJ h2G2aheUtfOHAJ9I59yWFqOAUJliVMOk1oq5fasy5+Ih65+w3HMJiUlerT7z+03QK2mf fa1RPytqzoHUXEf4OOguYGrNLBKK4FDTGUosQX4pNsVxMv/lrVJYnWDGzbPLmU4XoVS/ b4c44XodBu3n/5Jx3d3BNrcp1ADjo8fg0N89dHOVarqbm+Vaptv5F9AdWzID/eoNTVK9 PSzc3v7xDF0BNZWSONH/sNBDF6P6fctpqfem5Zbw90xvAFcoUytyZWgsm3KAZER/rS/Z QQ1Q== X-Gm-Message-State: AOJu0YyFSzdOy9JY1SAdPM6jl5cCcVMlzZgtel/9urb8jOvZjKfbqzVv 5KSSqMjC8JTRWpU4aA26XEV1tNrDPHQZ6P/H8DxEb+8lRQPTJW2bB9ti+nHYWPy1fOiCzYkpCaQ BpOWk5e5oj7vgaiKRjuEm9iPAVIWFlmw= X-Gm-Gg: AY/fxX5Wu6yNkYq3HUx/O9ln2GVpJqtoKt78AcIxswuI1N6X1YkkD4t0G8XFbpCu88Z vya8JbXZMLL+r0CZ6eTH0pybOKsqY2ltYtWBR7ytDcbiXEh13sNkgSdF00SDudOx1Kt0q9LzT14 DFIslS3cFT8HPKDU/zfakq5BgQtw1wqdPyQ0dY5Nutvl7vMRB2qxDy5J0JVFsDjo5+oN01hJUzw ezxhPmNOJn95oTCuAob1plSTKgIvx3Sl3z+oVdKprsoWwLjxhsG6aIz+05iYWkBSPXZkeU= X-Received: by 2002:a05:7300:d506:b0:2b0:520c:df62 with SMTP id 5a478bee46e88-2b6b3f29963mr8922000eec.19.1768814616195; Mon, 19 Jan 2026 01:23:36 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: lakshmi Date: Mon, 19 Jan 2026 14:55:43 +0530 X-Gm-Features: AZwV_Qi9xfSYoJEU4UICG54puljEafZJ_L4YZgJk5UtMtufMUkGr9wB6i2Oaydo Message-ID: Subject: Re: parallel data loading for pgbench -i To: Mircea Cadariu Cc: PostgreSQL Hackers Content-Type: multipart/alternative; boundary="000000000000df34a10648ba3e92" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000df34a10648ba3e92 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Mircea, I tested the patch on 19devel and it worked well for me. Before applying it, -j is rejected in pgbench initialization mode as expected. After applying the patch, pgbench -i -s 100 -j 10 runs successfully and shows a clear speedup. On my system the total runtime dropped to about 9.6s, with client-side data generation around 3.3s. I also checked correctness after the run =E2=80=94 row counts for pgbench_a= ccounts, pgbench_branches, and pgbench_tellers all match the expected values. Thanks for working on this, the improvement is very noticeable. Best regards, lakshmi On Mon, Jan 19, 2026 at 2:30=E2=80=AFPM Mircea Cadariu wrote: > Hi, > > I propose a patch for speeding up pgbench -i through multithreading. > > To enable this, pass -j and then the number of workers you want to use. > > Here are some results I got on my laptop: > > > master > > --- > > -i -s 100 > done in 20.95 s (drop tables 0.00 s, create tables 0.01 s, client-side > generate 14.51 s, vacuum 0.27 s, primary keys 6.16 s). > > -i -s 100 --partitions=3D10 > done in 29.73 s (drop tables 0.00 s, create tables 0.02 s, client-side > generate 16.33 s, vacuum 8.72 s, primary keys 4.67 s). > > > patch (-j 10) > > --- > > -i -s 100 -j 10 > done in 18.64 s (drop tables 0.00 s, create tables 0.01 s, client-side > generate 5.82 s, vacuum 6.89 s, primary keys 5.93 s). > > -i -s 100 -j 10 --partitions=3D10 > done in 14.66 s (drop tables 0.00 s, create tables 0.01 s, client-side > generate 8.42 s, vacuum 1.55 s, primary keys 4.68 s). > > The speedup is more significant for the partitioned use-case. This is > because all workers can use COPY FREEZE (thus incurring a lower vacuum > penalty) because they create their separate partitions. > > For the non-partitioned case the speedup is lower, but I observe it > improves somewhat with larger scale factors. When parallel vacuum > support is merged, this should further reduce the time. > > I'd still need to update docs, tests, better integrate the code with its > surroundings, and other aspects. Would appreciate any feedback on what I > have so far though. Thanks! > > Kind regards, > > Mircea Cadariu > > --000000000000df34a10648ba3e92 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Hi Mircea,

I tested the patch on 19devel and it worked well for me.
Before apply= ing it, -j is rejected in pgbench initialization mode as expec= ted. After applying the patch, pgbench -i -s 100 -j 10 runs su= ccessfully and shows a clear speedup.
On my system the total runtime dr= opped to about 9.6s, with client-side data generation around 3.3s.=C2=A0I also checked correctness after the run =E2=80=94 row counts for pgbench_= accounts, pgbench_branches, and pgbench_tellers all match the expected valu= es.

Thanks for working on this, the improvement is very noticeabl= e.

Best regards,
lakshmi



On Mon,= Jan 19, 2026 at 2:30=E2=80=AFPM Mircea Cadariu <cadariu.mircea@gmail.com> wrote:
Hi,

I propose a patch for speeding up pgbench -i through multithreading.

To enable this, pass -j and then the number of workers you want to use.

Here are some results I got on my laptop:


master

---

-i -s 100
done in 20.95 s (drop tables 0.00 s, create tables 0.01 s, client-side
generate 14.51 s, vacuum 0.27 s, primary keys 6.16 s).

-i -s 100 --partitions=3D10
done in 29.73 s (drop tables 0.00 s, create tables 0.02 s, client-side
generate 16.33 s, vacuum 8.72 s, primary keys 4.67 s).


patch (-j 10)

---

-i -s 100 -j 10
done in 18.64 s (drop tables 0.00 s, create tables 0.01 s, client-side
generate 5.82 s, vacuum 6.89 s, primary keys 5.93 s).

-i -s 100 -j 10 --partitions=3D10
done in 14.66 s (drop tables 0.00 s, create tables 0.01 s, client-side
generate 8.42 s, vacuum 1.55 s, primary keys 4.68 s).

The speedup is more significant for the partitioned use-case. This is
because all workers can use COPY FREEZE (thus incurring a lower vacuum
penalty) because they create their separate partitions.

For the non-partitioned case the speedup is lower, but I observe it
improves somewhat with larger scale factors. When parallel vacuum
support is merged, this should further reduce the time.

I'd still need to update docs, tests, better integrate the code with it= s
surroundings, and other aspects. Would appreciate any feedback on what I have so far though. Thanks!

Kind regards,

Mircea Cadariu

--000000000000df34a10648ba3e92--