Re: [HACKERS] path toward faster partition pruning

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Rajkumar Raghuwanshi <rajkumar(dot)raghuwanshi(at)enterprisedb(dot)com>
Cc: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Beena Emerson <memissemerson(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] path toward faster partition pruning
Date: 2017-11-22 08:59:48
Message-ID: df609168-b7fd-4c0b-e9b2-6e398d411e27@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
0001-Add-default-partition-case-in-inheritance-testing.patch text/plain 7.3 KB
0002-Tweak-default-range-partition-s-constraint-a-little.patch text/plain 4.5 KB
0003-Add-new-tests-for-partition-pruning-v13.patch text/plain 50.7 KB
0004-Add-a-bms_add_range-v13.patch text/plain 3.3 KB
0005-Planner-side-changes-for-partition-pruning-v13.patch text/plain 39.4 KB
0006-Implement-get_partitions_from_clauses-v13.patch text/plain 40.6 KB
0007-Some-interface-changes-for-partition_bound_-cmp-bsea-v13.patch text/plain 11.5 KB
0008-Implement-get_partitions_for_keys-v13.patch text/plain 39.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2017-11-22 09:06:28 Re: With commit 4e5fe9ad19, range partition missing handling for the NULL partition key
Previous Message amul sul 2017-11-22 08:42:19 Re: With commit 4e5fe9ad19, range partition missing handling for the NULL partition key