Opened 8 years ago

Closed 8 years ago

#27500 closed New feature (wontfix)

Warn about potentially significant performance degrading schema changes when making/running migrations

Reported by: Oliver Bristow Owned by: nobody
Component: Migrations Version: 1.8
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Today we ran a migration which removed a unique=True constraint on a char field for a MySQL database, this implicitly removed the indexing on the column which caused significant performance problems.

It didn't take too long to work out the mistake, but it would be nice if there was more of a fuss made when things like (implicit) index removal occur.

Hopefully this way developers are less likely to overlook or not be aware of such things, and also help pinpoint the source of an issue after an update.

Change History (3)

comment:1 by Tim Graham, 8 years ago

I don't know if it's Django's job to try to predict how schema changes might impact performance. What's fast for one database might be slow on another and it also depends on the number of rows. If you have a patch in mind, we can take a look, but I'm not certain this will be practical.

in reply to:  1 comment:2 by Oliver Bristow, 8 years ago

That is a fair point. I suppose it is more likely to be something for individual drivers to do, and even then it may be a bit out of character for Django to warn about something which may not be an issue. This would be particularly true at the migration stage, as the developers would have made an informed choice and then it would be down to them to mention it in the release notes if they feel it is appropriate.

The scope of this is probably quite large as it does touch on several drivers/the behaviour of various databases. In hindsight this probably isn't the kind of thing that would be done in a patch, as it would touch a lot of code and require a fair bit of insight which would probably come from various people.

p.s. while submitting this as a reply to the above with the body after quite, I got a "SpamBayes determined spam probability of 97.09%" message. Ouch

comment:3 by Tim Graham, 8 years ago

Component: Core (Management commands)Migrations
Resolution: wontfix
Status: newclosed
Type: UncategorizedNew feature
Note: See TracTickets for help on using tickets.
Back to Top