Re: Partitioning: how to exclude unrelated partitions?

Поиск
Список
Период
Сортировка
От paul rivers
Тема Re: Partitioning: how to exclude unrelated partitions?
Дата
Msg-id 472738A6.1020600@gmail.com
обсуждение исходный текст
Ответ на Partitioning: how to exclude unrelated partitions?  ("Sean Z." <sean09182006@yahoo.com>)
Список 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






В списке pgsql-general по дате отправления:

Предыдущее
От: Douglas McNaught
Дата:
Сообщение: Re: function and passing the table name to be used with SQL stmnt
Следующее
От: Brian Wipf
Дата:
Сообщение: Re: Base Backups from PITR Standby