Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q7IeL-0005c3-Px for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Jun 2023 16:38:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q7IeI-0004Rc-NP for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Jun 2023 16:38:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q7IeI-0004RT-B7 for pgsql-hackers@lists.postgresql.org; Thu, 08 Jun 2023 16:38:10 +0000 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1q7IeC-0013XT-Du for pgsql-hackers@postgresql.org; Thu, 08 Jun 2023 16:38:09 +0000 Received: by mail-ot1-x334.google.com with SMTP id 46e09a7af769-6af74ca9f4aso549305a34.3 for ; Thu, 08 Jun 2023 09:38:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=neon-tech.20221208.gappssmtp.com; s=20221208; t=1686242282; x=1688834282; h=in-reply-to:references:message-id:subject:cc:from:to:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=dt+OSqM80/dQ8CF5Vuq0f7kJwMt6/wueDMGNj+RCz+w=; b=sp9+Jmk91gUv0VmNeZxlXqjT4QMAIRGb2+CefqUP1F/89i1PAUwhcftVMCVttVEbgQ 5JGmZwNI2NJYKfXoa80y7Te+tMwFyFscCwhMLknAieC9VH7PMUDHgm3G7kYR/a5K0gat qtgtFLSBuV81C2rA8FNeTDfI2+P9/6hu/ogGVR//x+kZ4kPst1xhNdOHciCd/U30sitk eOU7TfZpvWf479o0FFLjg+FMmr+bNUUdzQrnjFvf7v9yedwCXOTKM1L4sJTjv+ccpZkP srWTk4AXR9SU2/gpEwiGe5qJF28yJM1Fpt6oRJTTUhvAi++1HeyLjdJp/VEJuoFSgiTk LcEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686242282; x=1688834282; h=in-reply-to:references:message-id:subject:cc:from:to:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=dt+OSqM80/dQ8CF5Vuq0f7kJwMt6/wueDMGNj+RCz+w=; b=OBXfY8j7k8TBn53gBVctois05DHAORt3vXPFw0y3mk2P5KArjlHfpkrO9OwLE9AbPV 6hIc42rTejO3qAtSFly32EiphVhd10V1mX4f0RGvY5VkKiSNjO9cIkmTGH2mDJvdlQDc 3gTJWRVhWwYd/+ZL13Us1crCM6MJ0maeZOGR1Xih5TZew9ebXbkdFjwnNWl3vrVKYAIM v8VoGRJpgnV89sbvXZNzSg0Ec0F/6c/2zFrJg//XcTnib8agZZReFB9Lxug/E+xcly+8 TDQihVjZVggz+pozQbKUYfKiqkQ8SNOrGhwVbbCSHLfvc+bICQRP0JyTTJj0QrRsgTc6 qEeQ== X-Gm-Message-State: AC+VfDzXc9VfZrodPVn8orUUHaUt7tJk9nhcsE9x3GuXMx4GHMUb9xnU L84TZo2VbjGGKe+chvceNDLLjLFa8WIQJA9wpu4= X-Google-Smtp-Source: ACHHUZ4K6BP2z/h7YDcDEioniRNz4voGvVBKEp4cp+JLHa0vK4I3zah0sCQdDoSp/6zGPJM6Cm6Lug== X-Received: by 2002:a05:6870:9572:b0:184:266a:1700 with SMTP id v50-20020a056870957200b00184266a1700mr6765912oal.47.1686242282703; Thu, 08 Jun 2023 09:38:02 -0700 (PDT) Received: from localhost ([2607:fb90:e696:c1dc:3996:e070:71ee:42fb]) by smtp.gmail.com with ESMTPSA id t39-20020a05687063a700b0019edd086f33sm952921oap.41.2023.06.08.09.38.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Jun 2023 09:38:02 -0700 (PDT) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 08 Jun 2023 11:38:01 -0500 To: "David Rowley" From: "Tristan Partin" Cc: Subject: Re: Use COPY for populating all pgbench tables Message-Id: X-Mailer: aerc 0.15.2-33-gedd4752268b2 References: In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu Jun 8, 2023 at 12:33 AM CDT, David Rowley wrote: > On Thu, 8 Jun 2023 at 07:16, Tristan Partin wrote: > > > > master: > > > > 50000000 of 50000000 tuples (100%) done (elapsed 260.93 s, remaining 0.= 00 s)) > > vacuuming... > > creating primary keys... > > done in 1414.26 s (drop tables 0.20 s, create tables 0.82 s, client-sid= e generate 1280.43 s, vacuum 2.55 s, primary keys 130.25 s). > > > > patchset: > > > > 50000000 of 50000000 tuples (100%) of pgbench_accounts done (elapsed 24= 3.82 s, remaining 0.00 s)) > > vacuuming... > > creating primary keys... > > done in 375.66 s (drop tables 0.14 s, create tables 0.73 s, client-side= generate 246.27 s, vacuum 2.77 s, primary keys 125.75 s). > > I've also previously found pgbench -i to be slow. It was a while ago, > and IIRC, it was due to the printfPQExpBuffer() being a bottleneck > inside pgbench. > > On seeing your email, it makes me wonder if PG16's hex integer > literals might help here. These should be much faster to generate in > pgbench and also parse on the postgres side. Do you have a link to some docs? I have not heard of the feature. Definitely feels like a worthy cause. > I wrote a quick and dirty patch to try that and I'm not really getting > the same performance increases as I'd have expected. I also tested > with your patch too and it does not look that impressive either when > running pgbench on the same machine as postgres. I didn't expect my patch to increase performance in all workloads. I was mainly aiming to fix high-latency connections. Based on your results that looks like a 4% reduction in performance of client-side data generation. I had thought maybe it is worth having a flag to keep the old way too, but I am not sure a 4% hit is really that big of a deal. > pgbench copy speedup > > ** master > drowley@amd3990x:~$ pgbench -i -s 1000 postgres > 100000000 of 100000000 tuples (100%) done (elapsed 74.15 s, remaining 0.0= 0 s) > vacuuming... > creating primary keys... > done in 95.71 s (drop tables 0.00 s, create tables 0.01 s, client-side > generate 74.45 s, vacuum 0.12 s, primary keys 21.13 s). > > ** David's Patched > drowley@amd3990x:~$ pgbench -i -s 1000 postgres > 100000000 of 100000000 tuples (100%) done (elapsed 69.64 s, remaining 0.0= 0 s) > vacuuming... > creating primary keys... > done in 90.22 s (drop tables 0.00 s, create tables 0.01 s, client-side > generate 69.91 s, vacuum 0.12 s, primary keys 20.18 s). > > ** Tristan's patch > drowley@amd3990x:~$ pgbench -i -s 1000 postgres > 100000000 of 100000000 tuples (100%) of pgbench_accounts done (elapsed > 77.44 s, remaining 0.00 s) > vacuuming... > creating primary keys... > done in 98.64 s (drop tables 0.00 s, create tables 0.01 s, client-side > generate 77.47 s, vacuum 0.12 s, primary keys 21.04 s). > > I'm interested to see what numbers you get. You'd need to test on > PG16 however. I left the old code in place to generate the decimal > numbers for versions < 16. I will try to test this soon and follow up on the thread. I definitely see no problems with your patch as is though. I would be more than happy to rebase my patches on yours. --=20 Tristan Partin Neon (https://neon.tech)