-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
fix: change constraint alters to non blocking for postgres #25164
fix: change constraint alters to non blocking for postgres #25164
Conversation
c9982d2
to
9bafa76
Compare
a5c10b5
to
3cef55e
Compare
...s/versions/2023-08-09_15-39_4448fa6deeb1__dd_on_delete_cascade_for_embedded_dashboards.py.py
Outdated
Show resolved
Hide resolved
3cef55e
to
424ed12
Compare
@eschutho Thank you for the improvement. I'll run this in our staging environment to test the change. Assuming it works, #24939, #24938, #24628, #24488 all add |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - Agree with @michael-s-molina that this should prob be dried up
@eschutho There's also a typo in one script name:
I think you meant |
thanks for the review @michael-s-molina. Since this is only improving Postgres, I'm thinking of just closing the Pr and running it locally unless others feel there's a benefit to the codebase in master. |
SUMMARY
This migration is marked as causing potential downtime, which we did see using a postgres db where it was locking the table while dropping the constraint and deadlocking with production db requests. I’m using two different techniques here to attempt to make this a more performant/non blocking migration so that we can run it without any downtime.
I have run the benchmark scripts several times up to over 1m rows which is much more than the size of the table that we had issues with. Other than the tests locally, this hasn’t been validated in production yet.
The other callout is that with renaming and then creating a new constraint, there is a period of time when there will be two constraints before the original one is dropped. From what I can tell it should work fine under these conditions but it has only been tested locally.
These changes only affect migrations running on Postgres metadata databases.
for the embedded table:
Results:
Current: 0.40 s
10+: 0.44 s
100+: 0.44 s
1000+: 0.26 s
10000+: 0.26 s
For the dashboard slices table:
Current: 0.30 s
10+: 0.45 s
100+: 0.45 s
1000+: 0.28 s
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION