Re: Help with details of what happens when I create a constraint NOT VALID

Поиск
Список
Период
Сортировка
От Marti Raudsepp
Тема Re: Help with details of what happens when I create a constraint NOT VALID
Дата
Msg-id CABRT9RAvQnVA8pDUtr_SzyVk7x+Z6iuC0YMufLqn4cY12vPhig@mail.gmail.com
обсуждение исходный текст
Ответ на Help with details of what happens when I create a constraint NOT VALID  (Bill Moran <wmoran@potentialtech.com>)
Список pgsql-general
On Thu, Jan 23, 2014 at 3:46 PM, Bill Moran <wmoran@potentialtech.com> wrote:
> It was suggested that
> leaving the constraints as NOT VALID might affect the planner, causing
> it to use less optimal plans because it doesn't think it can trust
> the constraint.  Is this true?

AFAICT the planner doesn't currently rely on FOREIGN KEY constriants
for anything, so there's no downside to leaving those NOT VALID.

UNIQUE constraints affect the planner the most, but they must always
be valid anyway.

If you use table inheritance (partitioning), then valid CHECK
constraints are necessary to use that effectively.

> It has also been suggested that manually changing the status to valid
> in the catalog without going through the validation process could cause
> problems

It's unsupported: if you break something when manually messing with
the system catalog, you get to keep the pieces and people will just
tell you "we told you so". But if you know what you're doing, it's OK.
Just make sure you double-check the source code that you're not
missing something critical that it does.

Regards,
Marti


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

Предыдущее
От: Thomas Kellerer
Дата:
Сообщение: Re: Fully-automatic streaming replication failover when master dies?
Следующее
От: "Manoj Agarwal"
Дата:
Сообщение: pg_dump: dumpBlobs(): could not open large object: ERROR: large object 27729547 does not exist