Re: To-Do item: skip table scan for adding column with provable check constraints

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: To-Do item: skip table scan for adding column with provable check constraints
Дата
Msg-id 17827.1464126595@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: To-Do item: skip table scan for adding column with provable check constraints  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: To-Do item: skip table scan for adding column with provable check constraints  (ilmari@ilmari.org (Dagfinn Ilmari Mannsåker))
Список pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> Right.  If there were a DEFAULT on the new column that would of course
> be different, and you can also do thinks like CHECK (a != b) here.
> However, if the CHECK constraint does not reference any column other
> than the newly-added one, and if the new column will have the same
> value for every row either because there is no default or because the
> default is a constant,

... and if the CHECK expression is immutable ...

> then we can test the CHECK constraint just once
> against the value that all new rows will have instead of testing it
> once per row.

I'm not entirely sure that this case occurs often enough to be worth the
trouble.  Although your formulation suggests that we could just execute
the expression once, rather than attempting to prove it true which is
what I think Jeff had in mind.  That would expand the scope of usefulness
considerably.
        regards, tom lane



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Allow COPY to use parameters
Следующее
От: Kevin Grittner
Дата:
Сообщение: Re: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <