#24224: sqlmigrate is slow
--------------------------------------+----------------------------
Reporter: TorstenRottmann | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Keywords: migration slow
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+----------------------------
When requesting an '''sqlmigrate''' (or when do a '''test''' or
'''migrate''' also), it takes a very long time to compute the sql for a
particular app migration. This app has some 78 models and is highly
interconnected with ForeignKeys (100+).[[BR]]
I ran the '''sqlmigrate''' through the profiler an got these
results:[[BR]]
{{{
74628418 function calls (74229555 primitive calls) in 3653.843
seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
4 3519.805 879.951 3519.805 879.951 {method 'write' of 'file'
objects}
552977 18.609 0.000 29.893 0.000 __init__.py:292(deconstruct)
40096 14.244 0.000 20.051 0.001
related.py:276(swappable_setting)
318698 11.924 0.000 21.114 0.000 __init__.py:1011(__init__)
575182 9.569 0.000 12.634 0.000 __init__.py:123(__init__)
571729 7.336 0.000 97.027 0.000
state.py:277(construct_fields)
16773896/16722010 6.750 0.000 6.790 0.000 {getattr}
85138 2.849 0.000 4.883 0.000 __init__.py:1092(__init__)
553122/553106 2.546 0.000 6.503 0.000 {__import__}
637429/318719 1.916 0.000 2.146 0.000
deconstruct.py:15(__new__)
3236790 1.912 0.000 1.912 0.000 {method 'startswith' of
'unicode' objects}
3881367/3881365 1.891 0.000 4.462 0.000 {isinstance}
5915601 1.566 0.000 1.841 0.000 options.py:283(_swapped)
43868 1.525 0.000 1.525 0.000
base.py:33(subclass_exception)
901715 1.508 0.000 2.571 0.000
abc.py:128(__instancecheck__)
21946/19820 1.486 0.000 24.646 0.001 base.py:61(__new__)
...
}}}
Waiting more than a minute for a test to start is very annoying ...
--
Ticket URL: <https://code.djangoproject.com/ticket/24224>
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/058.e5fcfaffb498798168f6145dc51c6f47%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.