Re: Declarative partitioning grammar

From: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
To: Gavin Sherry <swm(at)alcove(dot)com(dot)au>
Subject: Re: Declarative partitioning grammar
Date: 2008-01-11 23:42:20
Message-ID: 4787FEDC.9000607@cheapcomplexdevices.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gavin Sherry wrote:
> CREATE TABLE is modified to accept a PARTITION BY clause. This clause
> contains one or more partition declarations. The syntax is as follows:
> PARTITION BY {partition_type} (column_name[, column_name...])
> [PARTITIONS number]
> (
> partition_declaration[, partition_declaration...]
>
> )
> The partition type can be one of HASH, RANGE or LIST.

What would be the drawbacks of
CREATE TABLE tablename(...)
PARTITION BY function_taking_row_returning_partition_name
instead of the explicit types?

It seems that with my own function I could pretty easily emulate
the HASH,RANGE,or LIST types. It seems a function returning a
partition name would largely avoid the need for the sub-partition stuff
too -- at least for the cases when the only reason you wanted
sub-partitions was for composite partition support.

I'm not sure if a function would give more flexibility, but
it sure seems it'd be easier for me to remember than the various
PARTITION BY LIST (a) (
VALUES ('L') SUBPARTITION BY RANGE (b) (VALUES('x'),VALUES('y')),
VALUES ('M') SUBPARTITION BY RANGE (b) (VALUES('u'),VALUES('t')))
or whowever it'd look.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mike 2008-01-12 00:03:48 Re: Declarative partitioning grammar
Previous Message Gavin Sherry 2008-01-11 23:19:45 Declarative partitioning grammar