Re: Auto creation of Partitions

From: NikhilS <nikkhils(at)gmail(dot)com>
To: "Simon Riggs" <simon(at)2ndquadrant(dot)com>
Cc: "Shane Ambler" <pgsql(at)sheeky(dot)biz>, "Luke Lonergan" <llonergan(at)greenplum(dot)com>, "Zeugswetter Andreas ADI SD" <ZeugswetterA(at)spardat(dot)at>, "Peter Eisentraut" <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Auto creation of Partitions
Date: 2007-03-09 11:55:01
Message-ID: d3c4af540703090355y89178e2y314c0de0728527f9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Hi,

> Why would we support HASH partitions?
> If you did, the full syntax for hash clusters should be supported.

In MySQL, Oracle, the syntax for HASH partitions seems to be similar to the
one mentioned. I do not know much about hash clusters though.

If we do the CHECK clauses like that then we still have don't have a
> guaranteed non-overlap between partitions. It would be easier to use
> Oracle syntax and then construct the CHECK clauses from that.

Again Oracle, MySQL use "VALUES LESS THAN (expr)" format for RANGE
partitions. So you mean that they end up creating ranges like "MININT -
Range1", "Range1+1 - Range2" etc for each of the partitions?

I think Postgres users are used to the CHECK clauses and I still feel that
the onus of distinct partitions lies on the partition creator.

Also, the syntax needs to be fairly complex to allow for a mixture of
> modes, e.g. range and list partitioning. That is currently possible
> today and the syntax for doing that is IMHO much simpler than the Oracle
> "simple" way of specifying it.

Subpartitioning is not being targeted right now, but could be put on the
TODO list for further enhancements.

An alternative is to provide a partitioning function which decides which
> partition each values goes into.
>
> PARTITION FUNCTION which_partition(date_col)
>
> The partition function must return an unsigned integer > 0, which would
> correspond to particular partitions. Partitions would be numbered 1..N,
> and named tablename_partM where 1 <= M <= N.
>
> The input and contents of the partition function would be up to the
> user. e.g.
>
> CREATE FUNCTION range_partition(date date_col)
> {
> if (date_col < D1)
> return 1;
> else if (date_col < D2)
> return 2;
> else if (date_col < D3)
> return 3;
>
> return 4;
> }
>
> Doing it this way would allow us to easily join two tables based upon a
> common partition function.
>
> In time, I would suggest we support both ways: declarative and
> functional.

Till now, we are going the declarative way.

Regards,
Nikhils
--
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2007-03-09 12:22:59 Re: who gets paid for this
Previous Message Magnus Hagander 2007-03-09 11:33:08 Re: [COMMITTERS] pgsql: Remove unsafe calling of WSAStartup and WSA Cleanup from DllMain.

Browse pgsql-patches by date

  From Date Subject
Next Message Heikki Linnakangas 2007-03-09 12:08:51 Doc update, CLUSTER is not MVCC-safe
Previous Message Simon Riggs 2007-03-09 11:17:38 Re: Auto creation of Partitions