Categories
Database Development

practical effect of not validating FKs in Postgres?

I need to add a foreign key definition to a very large table in Postgres. (Let’s assume for the moment that I’m positive that every FK value is actually valid.)

I know that I can specify NOT VALID in order to prevent Postgres from taking aggressive locks on the table while validating the foreign key. Then I can go back "at leisure" and run VALIDATE CONSTRAINT as a cleanup.

What if I never bothered going back to run VALIDATE CONSTRAINT? Is there any practical effect of not doing so?

Leave a Reply

Your email address will not be published. Required fields are marked *