Hi,
I want to add a new column named sell_time to a table which already has
a boolean field named is_sold. Then I want to create a new check constraint:
ALTER TABLE ...
CHECK(is_sold AND sell_time IS NOT NULL OR
NOT is_sold AND sell_time IS NULL)
NOT VALID;
The constraint is added as NOT VALID for 2 reasons. 1) it is not valid
at that point and 2) I cannot afford the lock required to validate the it.
According to the docs subsequent operations on the table must pass the
constraint.
Now I can slowly populate the new column. After a while I'll reach a
point where the constraint is valid for all rows.
How can I tell that the database without the re-validation?
Alternatively, is there a way to make the constraint validation really
fast (a few seconds at most for 50.000.000 rows)? (this is 9.3)
Thanks,
Torsten
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера