Re: Table Partitions: To Inherit Or Not To Inherit

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: Table Partitions: To Inherit Or Not To Inherit
Дата
Msg-id 200411162151.14693.josh@agliodbs.com
обсуждение исходный текст
Ответ на Table Partitions: To Inherit Or Not To Inherit  (Don Drake <dondrake@gmail.com>)
Список pgsql-performance
Don,

> What's really the difference between this and creating separate tables
> with the same column definition without the inherit, and then create a
> view to "merge" them together?

Easier syntax for queries.   If you created completely seperate tables and
UNIONED them together, you'd have to be constantly modifying a VIEW which
tied the tables together.  With inheritance, you just do "SELECT * FROM
parent_table" and it handles finding all the children for you.

> Also, I've run into a snag in that I have a hourly_detail table, that
> has a foreign key to the hourly_report_data.  The inherit method above
> does not honor the foreign key relationship to the children table of
> hourly_report_data.  I can't insert any data into the hourly_detail
> table due to the constraint failing.

This is a known limitation of inherited tables, at least in current
implementations.   I think it's on the TODO list.   For now, either live
without the FKs, or implement them through custom triggers/rules.

--
Josh Berkus
Aglio Database Solutions
San Francisco

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

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Re: memcached and PostgreSQL
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: nuderstanding 'explain analyse'