2 ms·
You have a table with 200m rows in it. You want to me extract one of the columns in that table out to a new, separate table - a job that will take several hour
by simonw 5y ago
You have a table with 200m rows in it.
You want to me extract one of the columns in that table out to a new, separate table - a job that will take several hours to complete.
You want to do this without any visible downtime or breakage to your end-users - likely with some kind of complex dual-write and/or dual/read mechanism during that operation.
- clintonb 5y agoYou make the change in multiple phases. 1. Add the new table. 2. Update code to write/read from both the new and old data sources (e.g., read from the new table first before falling back to the old column). 3. Copy data from the column to the new table. 4. Update code to stop using the old column. 5. Remove the old column from the database. I wrote a blog post about this: https://medium.com/edx-engineering/django-migration-donts-f4588fd11b64 https://medium.com/edx-engineering/django-migration-donts-f4....