pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Tristan Partin <tristan@neon.tech>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Use COPY for populating all pgbench tables
Date: Thu, 20 Jul 2023 12:07:14 +0900
Message-ID: <ZLik4oKnqRmVCM3t@paquier.xyz> (raw)
In-Reply-To: <CU6CHPAYAKAS.1VW0CXIVL34CK@gonk>
References: <CSTU5P82ONZ1.19XFUGHMXHBRY@c3po>
	<CTCG9VOM6GJ4.3NDBRQ7U4EP4Z@gonk>
	<CTCHWOCZ9X8Z.1PDXVDUXZ3D0P@gonk>
	<ZKzik5uamTwRWHsY@paquier.xyz>
	<CTZFAQT1PDPQ.30VM4JHGNU3J@gonk>
	<ZK5C26HdJlRJ/yOl@paquier.xyz>
	<CU09K8PHEOIZ.I5NPQDPOQ1SO@gonk>
	<ZK91ET3oYP2OMfDI@paquier.xyz>
	<CU6CG3VTYTHS.148RQZ0NOMC12@gonk>
	<CU6CHPAYAKAS.1VW0CXIVL34CK@gonk>

On Wed, Jul 19, 2023 at 01:03:21PM -0500, Tristan Partin wrote:
> Didn't actually include the changes in the previous patch.

-initGenerateDataClientSide(PGconn *con)
+initBranch(PQExpBufferData *sql, int64 curr)
 {
-   PQExpBufferData sql;
+   /* "filler" column defaults to NULL */
+   printfPQExpBuffer(sql,
+                     INT64_FORMAT "\t0\t\n",
+                     curr + 1);
+}
+
+static void
+initTeller(PQExpBufferData *sql, int64 curr)
+{
+   /* "filler" column defaults to NULL */
+   printfPQExpBuffer(sql,
+                     INT64_FORMAT "\t" INT64_FORMAT "\t0\t\n",
+                     curr + 1, curr / ntellers + 1);

Hmm.  Something's not right here, see:
=# select count(*) has_nulls from pgbench_accounts where filler is null;
 has_nulls 
-----------
         0
(1 row)
=# select count(*) > 0 has_nulls from pgbench_tellers where filler is null;
 has_nulls 
-----------
 f
(1 row)
=# select count(*) > 0 has_nulls from pgbench_branches where filler is null;
 has_nulls 
-----------
 f
(1 row)

Note as well this comment in initCreateTables():
    /*
     * Note: TPC-B requires at least 100 bytes per row, and the "filler"
     * fields in these table declarations were intended to comply with that.
     * The pgbench_accounts table complies with that because the "filler"
     * column is set to blank-padded empty string. But for all other tables
     * the columns default to NULL and so don't actually take any space.  We
     * could fix that by giving them non-null default values.  However, that
     * would completely break comparability of pgbench results with prior
     * versions. Since pgbench has never pretended to be fully TPC-B compliant
     * anyway, we stick with the historical behavior.
     */

So this patch causes pgbench to not stick with its historical
behavior, and the change is incompatible with the comments because the
tellers and branches tables don't use NULL for their filler attribute
anymore.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (31+ messages)  latest in thread

Message-ID: <ZLik4oKnqRmVCM3t@paquier.xyz>
Permalink:  ../ZLik4oKnqRmVCM3t@paquier.xyz/
Also on:    postgresql.org/message-id/ZLik4oKnqRmVCM3t@paquier.xyz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: michael@paquier.xyz, tristan@neon.tech
  Subject: Re: Use COPY for populating all pgbench tables
  In-Reply-To: <ZLik4oKnqRmVCM3t@paquier.xyz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox