Re: Adding domain type with CHECK constraints slow on large table
В списке pgsql-general по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: Adding domain type with CHECK constraints slow on large table |
| Дата | |
| Msg-id | 15491.1190325938@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Adding domain type with CHECK constraints slow on large table (Jerry Sievers <jerry@jerrysievers.com>) |
| Ответы |
Re: Adding domain type with CHECK constraints slow on large table
|
| Список | pgsql-general |
Jerry Sievers <jerry@jerrysievers.com> writes:
> I believe what's happening here is that the server doesn't realize
> that the new column is going to have all nulls and that the check
> constraint allows nulls. As such, the check evidently is being
> evaluated for each row of the table.
Yup, that's right. There are some corner cases that make that harder to
optimize than it might look:
* volatile functions in the constraint might possibly deliver different
answers at different rows
* if table is in fact empty, we should not throw an error, nor indeed
evaluate the constraint even once (again, volatile functions...)
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера