Re: Use COPY for populating all pgbench tables

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Use COPY for populating all pgbench tables
Дата
Msg-id ZLik4oKnqRmVCM3t@paquier.xyz
обсуждение исходный текст
Ответ на Re: Use COPY for populating all pgbench tables  ("Tristan Partin" <tristan@neon.tech>)
Ответы Re: Use COPY for populating all pgbench tables
Список pgsql-hackers
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

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Smith
Дата:
Сообщение: Re: [PATCH] Reuse Workers and Replication Slots during Logical Replication
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: logicalrep_message_type throws an error