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

Add foreign keys to shadow table during swap #59

Closed
shayonj opened this issue Feb 27, 2022 · 1 comment
Closed

Add foreign keys to shadow table during swap #59

shayonj opened this issue Feb 27, 2022 · 1 comment
Labels
enhancement New feature or request p1

Comments

@shayonj
Copy link
Owner

shayonj commented Feb 27, 2022

We setup the shadow table with the FKs (if any) so its structurally the same as the primary table since beginning

'ALTER TABLE %s add constraint %s %s',

During INSERT INTO (copying date from primary table to shadow) it can become a blocking operation as the new data is being validated by the FK. Rather, we can trust the FK on the primary table and add back the FKs on the shadow table prior to swap, so post swap they are structurally the same. We can accordingly extend validate_constraint to validate constraint on primary and referential tables.

@shayonj
Copy link
Owner Author

shayonj commented Mar 13, 2022

done in #67

@shayonj shayonj closed this as completed Mar 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request p1
Projects
None yet
Development

No branches or pull requests

1 participant