Re: Order of enforcement of CHECK constraints?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Order of enforcement of CHECK constraints?
Дата
Msg-id 1342.1427124792@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Order of enforcement of CHECK constraints?  (Fabrízio de Royes Mello <fabriziomello@gmail.com>)
Ответы Re: Order of enforcement of CHECK constraints?  (Fabrízio de Royes Mello <fabriziomello@gmail.com>)
Список pgsql-hackers
Fabrízio de Royes Mello <fabriziomello@gmail.com> writes:
> On Fri, Mar 20, 2015 at 4:37 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>>> We could fix it by, say, having CheckConstraintFetch() sort the
>>>> constraints by name after loading them.

> Isn't better do this to read pg_constraint in name order?

> -   conscan = systable_beginscan(conrel, ConstraintRelidIndexId, true,
> +   conscan = systable_beginscan(conrel, ConstraintNameNspIndexId, true,

Surely not.  That would end up having to read *all* of pg_constraint, not
only the rows applicable to the current relation.

We could get the index to do the work for us if we changed it from an
index on conrelid to one on conrelid, conname.  However, seeing that that
would bloat the index by a factor of sixteen, it hardly sounds like a
free fix either.

I really think that a quick application of qsort is the best-performing
way to do this.
        regards, tom lane



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

Предыдущее
От: Jeff Janes
Дата:
Сообщение: Re: Table-level log_autovacuum_min_duration
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Zero-padding and zero-masking fixes for to_char(float)