Re: Declarative partitioning - Mailing list pgsql-hackers

From Thom Brown
Subject Re: Declarative partitioning
Date
Msg-id CAA-aLv7QbL77NLPeKP1omGYHBGP8jCnk9nW_opQqkddvjmp1-g@mail.gmail.com
Whole thread
In response to Re: Declarative partitioning  (Josh Berkus <josh@agliodbs.com>)
List pgsql-hackers
On 19 August 2015 at 21:10, Josh Berkus <josh@agliodbs.com> wrote:
On 08/19/2015 04:59 AM, Simon Riggs wrote:
> I like the idea of a regular partitioning step because it is how you
> design such tables - "lets use monthly partitions".
>
> This gives sanely terse syntax, rather than specifying pages and pages
> of exact values in DDL....
>
>    PARTITION BY RANGE ON (columns) INCREMENT BY (INTERVAL '1 month' )
> START WITH value;

Oh, I like that syntax!

How would it work if there were multiple columns?  Maybe we don't want
to allow that for this form?

If we went with that, and had:

CREATE TABLE orders (order_id serial, order_date date, item text)
  PARTITION BY RANGE ON (order_date) INCREMENT BY (INTERVAL '1 month')
  START WITH '2015-01-01';

Where would the following go?

INSERT INTO orders (order_date, item) VALUES ('2014-11-12', 'Old item');

Would there automatically be an "others" partition?  Or would it produce an error and act like a constraint?

Thom

pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Declarative partitioning
Next
From: Tom Lane
Date:
Subject: Re: Our trial to TPC-DS but optimizer made unreasonable plan