4

Is there no difference between the following examples?

Query 1:

objects.filter(a=b).exclude(c=d).filter(e=f).exclude(g=h).distinct()

Query 2:

objects.filter(a=b).filter(e=f).exclude(c=d).exclude(g=h).distinct()
Tom Maier
  • 293
  • 3
  • 12
  • 1
    No. You can verify that by doing `objects.filter(a=b).exclude(c=d).filter(e=f).exclude(g=h).distinct().query` and `objects.filter(a=b).filter(e=f).exclude(c=d).exclude(g=h).distinct().query` - The order of joins would be different, but the results would be the same. – karthikr Mar 05 '14 at 16:38
  • That is right, but does the order of joins matter? – Tom Maier Mar 05 '14 at 16:41
  • 2
    Well.. Order of joins would not matter for the result. – karthikr Mar 05 '14 at 16:42
  • ... but probably for performance. – Tom Maier Mar 05 '14 at 16:47
  • 3
    [Join order doesn't matter for performance](http://stackoverflow.com/questions/16360860/does-sql-join-order-affect-performance) – Alasdair Mar 05 '14 at 16:56

0 Answers0