Forcefully adding a CHECK constrained

Поиск
Список
Период
Сортировка
От Catalin(ux) M. BOIE
Тема Forcefully adding a CHECK constrained
Дата
Msg-id alpine.LFD.2.02.1205151239120.24617@mail.embedromix.ro
обсуждение исходный текст
Ответы Re: Forcefully adding a CHECK constrained  (Jeff Davis <pgsql@j-davis.com>)
Re: Forcefully adding a CHECK constrained  (Marti Raudsepp <marti@juffo.org>)
Список pgsql-general
Hello.

When I discovered the wonders of partitioning I quickly jumped on-board.
I had big tables used for statistics and a split was needed.

I created the parent, I linked the big table with this new parent and I
added other childs, per month.

Example:
new_stats - parent (empty)
     old_stats - child, no CHECK
     stats_2012_04 - child, with CHECK
     stats_2012_05 - child, with CHECK

The old_stats is so big that I cannot afford to add a check constraint.
But, I know that all values of the itime field are before 2012_04, so,
would be great if I could run something like:

ALTER TABLE old_stats ADD CONSTRAINT xxx CHECK (itime < 2012_04_timestamp)
FORCE;

Of course I can create an index concurrently and then add constraint using
"USING INDEX", but this means a scan of the big table.

I never looked at PostgreSQL sources, but the commit
Enable CHECK constraints to be declared NOT VALID
http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=897795240cfaaed724af2f53ed2c50c9862f951f
inspired me to dive.
Is PostgreSQL's team willing to accept such a feature?

Thank you for your time!

(Please keep me on cc)

--
Catalin(ux) M. BOIE
http://kernel.embedromix.ro/

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Vacuum does not show in pg_stat_all_tables
Следующее
От: Condor
Дата:
Сообщение: Re: Vacuum does not show in pg_stat_all_tables