Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.7] Add "NOT VALID" option for skipping validation when adding postgres foreign keys #26775

Merged
merged 1 commit into from
Dec 7, 2018

Conversation

jaewun
Copy link
Contributor

@jaewun jaewun commented Dec 7, 2018

Adding a foreign index to a postgres table requires an exclusive access lock on the table as postgres validates the existing data. This can be a lengthy check, and in our case lead to the lock queue spinning out of control.

"not valid", tells postgres to skip this data validation and therefore it doesn't require an exclusive lock.

Further reading:
https://travisofthenorth.com/blog/2017/2/2/postgres-adding-foreign-keys-with-zero-downtime

@driesvints driesvints changed the title Add "NOT VALID" option for skipping validation when adding postgres foreign keys [5.7] Add "NOT VALID" option for skipping validation when adding postgres foreign keys Dec 7, 2018
@taylorotwell taylorotwell merged commit 3086582 into laravel:5.7 Dec 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants