#24554: Migrations taking up to an hour to run
-------------------------------------+-------------------------------------
     Reporter:  ryanahall            |                    Owner:  ryanahall
         Type:                       |                   Status:  assigned
  Cleanup/optimization               |
    Component:  Migrations           |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by ryanahall):

 @knbk thanks for pointing out that change, I'll pull it and give it a
 shot. I also just commented on my pr, but for the sake of consistency I'll
 put it here as well.

 Thanks for the quick response @MarkusH, I just pulled that pr's branch and
 tested it out - looks good to me! Here's the output from cProfile this
 time around:

 {{{
         1    0.001    0.001 1047.865 1047.865 manage.py:2(<module>)
         1    0.000    0.000 1047.800 1047.800
 /django/core/management/__init__.py:325(execute_from_command_line)
         1    0.000    0.000 1047.800 1047.800
 /django/core/management/__init__.py:265(execute)
         1    0.000    0.000 1040.621 1040.621
 /django/core/management/base.py:326(run_from_argv)
         1    0.002    0.002 1040.619 1040.619
 /django/core/management/base.py:361(execute)
         1    0.174    0.174 1039.459 1039.459
 /django/core/management/commands/migrate.py:50(handle)
         1    0.084    0.084 1036.643 1036.643
 /django/db/migrations/executor.py:65(migrate)
      3851    0.329    0.000  958.341    0.249
 /django/db/migrations/state.py:87(reload_model)
       800    0.014    0.000  953.813    1.192
 /django/db/migrations/migration.py:72(mutate_state)
      3153    0.178    0.000  455.806    0.145
 /django/db/migrations/state.py:230(render_multiple)
    133631   31.220    0.000  438.594    0.003
 /django/apps/registry.py:323(clear_cache)
     56702    2.274    0.000  425.492    0.008
 /django/db/migrations/state.py:505(render)
      1745    0.021    0.000  420.844    0.241
 /django/db/migrations/operations/fields.py:43(state_forwards)
     62640    0.281    0.000  407.227    0.007
 /django/db/migrations/state.py:279(unregister_model)
      1166    0.031    0.000  402.408    0.345
 /django/db/migrations/operations/fields.py:172(state_forwards)
   1358075    6.334    0.000  383.427    0.000
 /django/db/migrations/state.py:474(construct_fields)
  30963570  233.718    0.000  347.263    0.000
 /django/db/models/options.py:712(_expire_cache)
    139593  116.218    0.001  253.901    0.002
 /django/db/models/fields/related.py:297(swappable_setting)
    127628    0.681    0.000  238.117    0.002
 /django/db/models/fields/related.py:1927(deconstruct)
    127628    1.165    0.000  237.204    0.002
 /django/db/models/fields/related.py:1635(deconstruct)
 }}}

 For reference, most of the time was spent while rendering the states which
 was expected.

--
Ticket URL: <https://code.djangoproject.com/ticket/24554#comment:6>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.ef62e584964b5484f72caf5926659a95%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to