Re: pgbench - allow to create partitioned tables

Fabien COELHO <coelho@cri.ensmp.fr>

From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Asif Rehman <asifr.rehman@gmail.com>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2019-09-24T13:29:42Z
Lists: pgsql-hackers

Attachments

Hello Amit,

> {...]
> If you agree with this, then why haven't you changed below check in patch:
>
> + if (partition_method != PART_NONE)
> + printf("partition method: %s\npartitions: %d\n",
> +    PARTITION_METHOD[partition_method], partitions);
>
> This is exactly the thing bothering me.  It won't be easy for others
> to understand why this check for partitioning information is different
> from other checks.

As I tried to explain with an example, using "partitions > 0" does not 
work in this case because you can have a partitioned table with zero 
partitions attached while benchmarking, but this cannot happen while 
creating.

> For you or me, it might be okay as we have discussed this case, but it 
> won't be apparent to others.  This doesn't buy us much, so it is better 
> to keep this code consistent with other places that check for 
> partitions.

Attached uses "partition_method != PART_NONE" consistently, plus an assert 
on "partitions > 0" for checking and for triggering the default method at 
the end of option processing.

-- 
Fabien.

Commits

  1. pgbench: add --partitions and --partition-method options.