Re: pgbench - allow to create partitioned tables - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: pgbench - allow to create partitioned tables
Date
Msg-id alpine.DEB.2.21.1909131031250.20765@lancre
Whole thread Raw
In response to Re: pgbench - allow to create partitioned tables  (Dilip Kumar <dilipbalaut@gmail.com>)
Responses Re: pgbench - allow to create partitioned tables
List pgsql-hackers
Hello Dilip,

> + /* For RANGE, we use open-ended partitions at the beginning and end */
> + if (p == 1)
> + sprintf(minvalue, "minvalue");
> + else
> + sprintf(minvalue, INT64_FORMAT, (p-1) * part_size + 1);
> +
> + if (p < partitions)
> + sprintf(maxvalue, INT64_FORMAT, p * part_size + 1);
> + else
> + sprintf(maxvalue, "maxvalue");
>
> I do not understand the reason why first partition need to be 
> open-ended?  Because we are clear that the minimum value of the aid is 1 
> in pgbench_accout.  So if you directly use sprintf(minvalue, 
> INT64_FORMAT, (p-1) * part_size + 1);  then also it will give 1 as 
> minvalue for the first partition and that will be the right thing to do. 
> Am I missing something here?

This is simply for the principle that any value allowed for the primary 
key type has a corresponding partition, and also that it exercices these 
special values.

It also probably reduces the cost of checking whether a value belongs to 
the first partition because one test is removed, so there is a small 
additional performance benefit beyond principle and coverage.

-- 
Fabien.



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [PATCH][PROPOSAL] Add enum releation option type
Next
From: Konstantin Knizhnik
Date:
Subject: Re: Why overhead of SPI is so large?