Re: [POC] hash partitioning

From: amul sul <sulamul(at)gmail(dot)com>
To: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>, David Steele <david(at)pgmasters(dot)net>, Greg Stark <stark(at)mit(dot)edu>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [POC] hash partitioning
Date: 2017-05-14 08:00:24
Message-ID: CAAJ_b95yxAEHSmGavrzg0O52OGvX0c_CkZmdNFYOjH9pNdsozg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, May 13, 2017 at 12:11 PM, Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
> On Fri, May 12, 2017 at 6:08 PM, amul sul <sulamul(at)gmail(dot)com> wrote:
>> Hi,
>>
>> Please find the following updated patches attached:
>
> I have done some testing with the new patch, most of the cases worked
> as per the expectation except below
>
> I expect the planner to select only "Seq Scan on t1" whereas it's
> scanning both the partitions?
>
> create table t (a int, b varchar) partition by hash(a);
> create table t1 partition of t for values with (modulus 8, remainder 0);
> create table t2 partition of t for values with (modulus 8, remainder 1);
>
> postgres=# explain select * from t where a=8;
> QUERY PLAN
> ----------------------------------------------------------
> Append (cost=0.00..51.75 rows=12 width=36)
> -> Seq Scan on t1 (cost=0.00..25.88 rows=6 width=36)
> Filter: (a = 8)
> -> Seq Scan on t2 (cost=0.00..25.88 rows=6 width=36)
> Filter: (a = 8)
> (5 rows)
>
You are correct. As of now constraint exclusion doesn't work on
partition constraint involves function call[1], and hash partition
constraint does have satisfies_hash_partition() function call.

>
> Some cosmetic comments.
> -----------------------------------
> + RangeVar *rv = makeRangeVarFromNameList(castNode(List, nameEl->arg));
> +
>
> Useless Hunk.
>
> /*
> - * Build a CREATE SEQUENCE command to create the sequence object, and
> - * add it to the list of things to be done before this CREATE/ALTER
> - * TABLE.
> + * Build a CREATE SEQUENCE command to create the sequence object, and add
> + * it to the list of things to be done before this CREATE/ALTER TABLE.
> */
>
> Seems like, in src/backend/parser/parse_utilcmd.c, you have changed
> the existing code with
> pgindent. I think it's not a good idea to mix pgindent changes with your patch.
>
Oops, my silly mistake, sorry about that. Fixed in attached version.

Regards,
Amul

1] https://www.postgresql.org/message-id/CA%2BTgmoaE9NZ_RiqZQLp2aJXPO4E78QxkQYL-FR2zCDop96Ahdg%40mail.gmail.com

Attachment Content-Type Size
0001-Cleanup_v2.patch application/octet-stream 4.4 KB
0002-hash-partitioning_another_design-v4.patch application/octet-stream 75.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Nieuwenhuizen 2017-05-14 10:49:09 Re: postgres 9.6.2 update breakage
Previous Message amul sul 2017-05-14 07:00:58 Re: [POC] hash partitioning