From: | paul rivers <rivers(dot)paul(at)gmail(dot)com> |
---|---|
To: | "Sean Z(dot)" <sean09182006(at)yahoo(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Partitioning: how to exclude unrelated partitions? |
Date: | 2007-10-30 13:59:02 |
Message-ID: | 472738A6.1020600@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Sean Z. wrote:
> Hi,
>
> I partitioned a table "events" into 31 tables, based on "day" of
> event_time.
>
> I did 3 steps to setup partition, after creating partition tables:
>
> 1. Add the constraint to the 31 partition tables like:
>
> ALTER TABLE events_day_1
> ADD CONSTRAINT events_day_1_event_time_check CHECK
> (date_part('day'::text, event_time) = 1::double precision);
>
> [snip]
>
> Do I miss anything?
>
> Best,
> Sean
>
I believe you can only partition on literal values. You'll probably
need to include a derived 'day' column in your table that you can
populate in the rule. Your query will then need to include the literal
day value in the where clause, rather than the event_time.
Check out the caveats section for partitioning here (bottom of page, 5.9.5):
http://www.postgresql.org/docs/8.2/interactive/ddl-partitioning.html
It's not terribly obvious at first reading, as the focus is more on
querying than designing the table. Maybe that would be worth expanding
on a little in the docs?
Regards,
Paul
From | Date | Subject | |
---|---|---|---|
Next Message | Brian Wipf | 2007-10-30 14:25:45 | Re: Base Backups from PITR Standby |
Previous Message | Douglas McNaught | 2007-10-30 13:53:23 | Re: function and passing the table name to be used with SQL stmnt |