pgbench using COPY FREEZE

Started by Simon Riggsover 4 years ago4 messages
#1Simon Riggs
simon.riggs@enterprisedb.com
1 attachment(s)

pgbench -i should use COPY FREEZE, patch attached.

--
Simon Riggs http://www.EnterpriseDB.com/

Attachments:

pgbench_copy_freeze.v1.patchapplication/octet-stream; name=pgbench_copy_freeze.v1.patchDownload
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index dc84b7b9b7..feb8f601ce 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -4162,7 +4162,11 @@ initGenerateDataClientSide(PGconn *con)
 	/*
 	 * accounts is big enough to be worth using COPY and tracking runtime
 	 */
-	res = PQexec(con, "copy pgbench_accounts from stdin");
+	resetPQExpBuffer(&sql);
+	appendPQExpBufferStr(&sql, "copy pgbench_accounts from stdin");
+	if (partitions == 0)
+		appendPQExpBufferStr(&sql, " with (freeze)");
+	res = PQexec(con, sql.data);
 	if (PQresultStatus(res) != PGRES_COPY_IN)
 	{
 		pg_log_fatal("unexpected copy in result: %s", PQerrorMessage(con));
#2Fabien COELHO
coelho@cri.ensmp.fr
In reply to: Simon Riggs (#1)
Re: pgbench using COPY FREEZE

Hello Simon,

Indeed.

There is already a "ready" patch in the queue, see:

https://commitfest.postgresql.org/33/3034/

--
Fabien.

#3Simon Riggs
simon.riggs@enterprisedb.com
In reply to: Fabien COELHO (#2)
Re: pgbench using COPY FREEZE

On Thu, Jun 24, 2021 at 7:15 PM Fabien COELHO <coelho@cri.ensmp.fr> wrote:

Hello Simon,

Indeed.

There is already a "ready" patch in the queue, see:

https://commitfest.postgresql.org/33/3034/

Ah, my bad. I withdraw this patch, apologies Tatsuo-san.

--
Simon Riggs http://www.EnterpriseDB.com/

#4Tatsuo Ishii
ishii@sraoss.co.jp
In reply to: Simon Riggs (#3)
Re: pgbench using COPY FREEZE

Hi Simon,

Hello Simon,

Indeed.

There is already a "ready" patch in the queue, see:

https://commitfest.postgresql.org/33/3034/

Ah, my bad. I withdraw this patch, apologies Tatsuo-san.

No problem at all. Thank you for looking into the issue.
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp