#35015 closed Cleanup/optimization (fixed)
Update MySQL migration documentation for Mysql 8
Reported by: | Nicolas Lupien | Owned by: | Nicolas Lupien |
---|---|---|---|
Component: | Documentation | Version: | 5.0 |
Severity: | Normal | Keywords: | mysql |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Now that Django dropped support for MySQL 5.7, I think the documentation is no longer valid.
MySQL lacks support for transactions around schema alteration operations, meaning that if a migration fails to apply you will have to manually unpick the changes in order to try again (it’s impossible to roll back to an earlier point).
In addition, MySQL will fully rewrite tables for almost every schema operation and generally takes a time proportional to the number of rows in the table to add or remove columns. On slower hardware this can be worse than a minute per million rows - adding a few columns to a table with just a few million rows could lock your site up for over ten minutes.
Finally, MySQL has relatively small limits on name lengths for columns, tables and indexes, as well as a limit on the combined size of all columns an index covers. This means that indexes that are possible on other backends will fail to be created under MySQL.
https://docs.djangoproject.com/en/5.0/topics/migrations/#mysql
Change History (11)
comment:1 by , 13 months ago
Description: | modified (diff) |
---|
comment:2 by , 13 months ago
comment:3 by , 13 months ago
Which parts of the documentation you believe are not accurate?
I'm not a MySQL expert, it's just that reading this section of the docs seemed outdated. Like you pointed out, many DDL operations in MySQL 8 happens without locking.
Would you be interested in submitting a patch that addresses the inaccuracies?
Yes, I'll be happy to do the research and submit a patch!
comment:4 by , 13 months ago
Keywords: | mysql added |
---|---|
Resolution: | → needsinfo |
Status: | new → closed |
Type: | Uncategorized → Cleanup/optimization |
Maybe a middle sentence:
In addition, MySQL will fully rewrite tables for almost every schema operation and generally takes a time proportional to the number of rows in the table to add or remove columns. On slower hardware this can be worse than a minute per million rows - adding a few columns to a table with just a few million rows could lock your site up for over ten minutes.
is a bit inaccurate, but you haven't presented any references to prove it. Also, generally this paragraph is still valid. Closing as "needsinfo" for now. Feel-free to investigate and provide details what and where is wrong in docs.
comment:5 by , 13 months ago
Resolution: | needsinfo |
---|---|
Status: | closed → new |
This is my first contribution, let me know if I missed something. https://github.com/django/django/pull/17582
comment:6 by , 13 months ago
Has patch: | set |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:7 by , 13 months ago
Thank you for your patch Nicolas! I think the wording for the online DDL operations section is great but that we should keep the section about InnoDB limitations.
comment:8 by , 13 months ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:9 by , 12 months ago
Patch needs improvement: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
This is still true.
That's no longer true for most operations and should be adjusted. I guess we could link to MySQL's Online DDL operations docs.
I'm pretty sure this is still true to a certain extent.
Which parts of the documentation you believe are not accurate? Would you be interested in submitting a patch that addresses the inaccuracies?