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

How to migrate existing table to use partitioning? #164

Closed
sknutsonsf opened this issue Dec 18, 2021 · 1 comment
Closed

How to migrate existing table to use partitioning? #164

sknutsonsf opened this issue Dec 18, 2021 · 1 comment

Comments

@sknutsonsf
Copy link

What is a method to migrate an existing table to use range partitioning? Can this be added into the documentation?

My SensorData table has about 400M rows (73gb) so space matters (indexes are about 20gb). I need to make sure indexes get dropped, then data copied to the new table with partitions, and finally indexes created on the partitioned table. This needs to happen over several migrations (or a non-atomic migration) so space can be freed.

I've tried a couple of approaches and all seem to fail with some problem around the indexes and ForeignKey constraints. I really want the final django object and table to end up the same names.

@Photonios
Copy link
Member

This is such a complex problem that it would be dangerous for this package to try to support this. You should solve this outside Django use state-only migration operations to bring Django up to date with reality.

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

No branches or pull requests

2 participants