Re: [HACKERS] path toward faster partition pruning - Mailing list pgsql-hackers

From Amit Langote
Subject Re: [HACKERS] path toward faster partition pruning
Date
Msg-id df609168-b7fd-4c0b-e9b2-6e398d411e27@lab.ntt.co.jp
Whole thread Raw
In response to Re: [HACKERS] path toward faster partition pruning  (Rajkumar Raghuwanshi <rajkumar.raghuwanshi@enterprisedb.com>)
Responses Re: [HACKERS] path toward faster partition pruning  (Jesper Pedersen <jesper.pedersen@redhat.com>)
Re: [HACKERS] path toward faster partition pruning  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Re: [HACKERS] path toward faster partition pruning  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Thanks Rajkumar for the test.

On 2017/11/21 19:06, Rajkumar Raghuwanshi wrote:
> CREATE TABLE hp_tbl (a int, b int, c int) PARTITION BY HASH (a);
> CREATE TABLE hp_tbl_p1 PARTITION OF hp_tbl FOR VALUES WITH (modulus 4,
> remainder 0) PARTITION BY HASH (b);
> CREATE TABLE hp_tbl_p1_p1 PARTITION OF hp_tbl_p1 FOR VALUES WITH (modulus
> 4, remainder 0) PARTITION BY HASH (c);
> CREATE TABLE hp_tbl_p1_p1_p1 PARTITION OF hp_tbl_p1_p1 FOR VALUES WITH
> (modulus 4, remainder 0);
> CREATE TABLE hp_tbl_p2 PARTITION OF hp_tbl FOR VALUES WITH (modulus 4,
> remainder 1) PARTITION BY HASH (b);
> CREATE TABLE hp_tbl_p2_p1 PARTITION OF hp_tbl_p2 FOR VALUES WITH (modulus
> 4, remainder 1);
> CREATE TABLE hp_tbl_p2_p2 PARTITION OF hp_tbl_p2 FOR VALUES WITH (modulus
> 4, remainder 2);
> insert into  hp_tbl select i,i,i from generate_series(0,10)i where i not
> in(2,4,6,7,10);
> 
> explain select * from hp_tbl where a = 2;
> server closed the connection unexpectedly
>     This probably means the server terminated abnormally
>     before or while processing the request.
> The connection to the server was lost. Attempting reset: Failed.
> !>

It seems I wrote an Assert in the code to support hash partitioning that
wasn't based on a valid assumption.  I was wrongly assuming that all hash
partitions for a given modulus (largest modulus) must exist at any given
time, but that isn't the case.

Fixed in the attached.  No other changes beside that.

Thanks,
Amit

Attachment

pgsql-hackers by date:

Previous
From: amul sul
Date:
Subject: Re: With commit 4e5fe9ad19, range partition missing handling for theNULL partition key
Next
From: Amit Langote
Date:
Subject: Re: With commit 4e5fe9ad19, range partition missing handling for theNULL partition key