Yes, the more relationships your models have the more time expensive migrations 
become. Adding/Altering/Removing a field (ForeignKey or not) always requires 
all related models to be recreated. See 
https://github.com/django/django/blob/master/django/db/migrations/state.py#L53 
for the reasoning behind that.

I have an idea / PoC of how to speed up that model reloading but I'm not quite 
there yet. I hope to have time to investigate and try out my idea over the next 
months.

/Markus

On January 8, 2016 4:50:50 PM GMT+11:00, Peter Baumgartner 
<[email protected]> wrote:
>Reporting back on some additional findings for what it's worth.
>SmileyChris dumped and recreated the project in question's migrations,
>manually ordering them to minimize dependencies. It was not a major
>reduction in total migrations: 82 to 58 (mostly third-party migrations
>and initials), but the time to create an empty migration dropped
>massively. It went from 260s on 1.8.6 (160s on 1.9.1) to 2s on both
>versions.
>
>I'm not sure what to make of it, but the slowness I was seeing doesn't
>seem to be as much related to number of migrations, but perhaps the
>contents of the migrations files. Is it possible that having lots of
>cross-app migration dependencies could be the cause?
>
>Thanks as always!
>
>-- Pete
>
>On Thu, Jan 7, 2016 at 3:12 PM, Carl Meyer <[email protected]> wrote:
>> On 01/07/2016 03:03 PM, Aymeric Augustin wrote:
>>> As far as I understand, the CPU cost comes from generating a full
>set of
>>> model classes for each step of the migration history. That’s
>consistent
>>> with the pr

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" 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].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/9CB52F30-5A7A-4502-8CEF-793AA1CE1360%40markusholtermann.eu.
For more options, visit https://groups.google.com/d/optout.
  • ... Tim Graham
    • ... Florian Apolloner
      • ... Peter Baumgartner
        • ... Aymeric Augustin
          • ... Andrew Godwin
          • ... Carl Meyer
            • ... Peter Baumgartner
              • ... Markus Holtermann
            • ... 'Hugo Osvaldo Barrera' via Django developers (Contributions to Django itself)
              • ... Shai Berger
                • ... charettes
                • ... Carl Meyer
                • ... Shai Berger
                • ... René Fleschenberg

Reply via email to