#30867: Old indexes should be dropped after new ones are created.
--------------------------------------+------------------------------------
     Reporter:  Simon Charette        |                    Owner:  nobody
         Type:  Cleanup/optimization  |                   Status:  closed
    Component:  Migrations            |                  Version:  master
     Severity:  Normal                |               Resolution:  wontfix
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  0                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------
Changes (by Simon Charette):

 * status:  new => closed
 * resolution:   => wontfix


Comment:

 After a bit of investigation it looks like this would effectively add a
 lot of complexity to the already complex `_alter_field` for little benefit
 because the optimization is only valuable when only performing a
 `(db_index=True)` to `(unique=True)` migration. If the field type is also
 meant to be altered (e.g type) we certainly want to drop the index before
 hand to avoid an internal rebuild with the new type which makes it hard to
 determine when the optimization should be performed.

 For the record I managed to get a noticeable speed up (10-15%) on
 PostgreSQL when adding a unique constraint to an already indexed column
 (10M rows integer).

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30867#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.fe6dc8fbce6d8ae69b6d69b32d3f4635%40djangoproject.com.

Reply via email to