When you have AddField('A', 'foo', ForeignKey('B')), this operation references A and foo, but also references B.
RemoveField('A', 'foo') also references A and foo, but does it reference B? if it does, then it' s hard to have optimizations that pass through this, because this field could be referencing any model (theoretically). But if we assert that RemoveField doesn't refer to any models referenced to by its field, then our optimizer can take a couple more liberties. Raphael On Friday, February 17, 2017 at 2:15:47 AM UTC+9, Markus Holtermann wrote: > > I'm not sure if it's related or not wo what you're investigating, > RemoveField cannot "just" optimized through, as you might have another > AddField operation afterwards adding another field with the same name. > > /Markus > > On Thu, Feb 16, 2017 at 08:19:01AM -0800, rap...@makeleaps.com > <javascript:> wrote: > >Hey Simon, > > > > I looked through your PR and added a couple comments. The main thing is > I > >think we can actually ignore the field context on "RemoveField", if only > >because the executor doesn't need it. Even though the field might be > >pointing to a related model, that doesn't prevent being optimized > through. > > > > This is hard to explain, but intuitively, each "RemoveField" is paired > >with an "AddField" or "CreateModel" that *does *depend on the related > >model. So if we have a potentially dangerous optimization, those initial > >operations will "protect" the causal order, not "RemoveField". > > > > Raphael > > > >-- > >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 django-develop...@googlegroups.com <javascript:>. > >To post to this group, send email to django-d...@googlegroups.com > <javascript:>. > >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/9dfdcec6-b98c-44f2-86af-99aaa8857cc9%40googlegroups.com. > > > >For more options, visit https://groups.google.com/d/optout. > > -- 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 django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. 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/7515c909-a015-451d-bdaa-f040e6322166%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.