| От | Florian Weimer |
|---|---|
| Тема | Re: Is it possible to speed up addition of "not null"? |
| Дата | |
| Msg-id | 82ehud2tpg.fsf@mid.bfk.de обсуждение исходный текст |
| Ответ на | Re: Is it possible to speed up addition of "not null"? (hubert depesz lubaczewski <depesz@depesz.com>) |
| Список | pgsql-general |
* hubert depesz lubaczewski: > procedure would look like: > 1. update pg_attribute set attnotnull = true where attrelid = 'my_table'::regclass and attname = 'not-null-column'; > 2. delete from my_table where not-null-column is null; -- this shouldn't > do anything, as I know that there are no null values, but just in > case > 3. pg_reorg of the table. You could install a trigger before step 1 which prevents INSERTs and UPDATEs which would add even more rows violating the constraint. I'm not sure if the DELETE will actually do anything, given that pg_attribute says that the column cannot be NULL. -- Florian Weimer <fweimer@bfk.de> BFK edv-consulting GmbH http://www.bfk.de/ Kriegsstraße 100 tel: +49-721-96201-1 D-76133 Karlsruhe fax: +49-721-96201-99
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера