Hi Yves, zen! Nice.
On Thu, Jun 11, 2020, 9:27 PM Yves de Champlain <[email protected]> wrote: > Hi > > I am wondering at some ways one can write a query in Django. Let's say for > example : > > Whatever.objects.filter(fk_object_id=fk_object_id) > Whatever.objects.filter(fk_object_id=fk_object.id) > Whatever.objects.filter(fk_object=fk_object) > > and I could add to that list fk_object__id and fk_object__id__exact but > my question is that while these syntaxes are equivalent in termes of > results, one of them has got to be more efficient. I have read some posts > about the subject, usually about optimizations, and could also guess that > using an ID directly makes less behind-the-scene operations. On the other > side, fk_object=fk_object surely looks more clean and concise to me. > > I know I don't master the subtleties of all these syntaxes, but my > question is why does Django not support only one (the most) efficient way > of writing queries ? > > Thanks for your thoughts about this. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/15077d25-1460-4783-9339-7e0ce8d21259o%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/15077d25-1460-4783-9339-7e0ce8d21259o%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAP5HUWpFcb9HYy9sgOG%3DpKC0LsSn0J1a_nx51JNHz%3Di5u54f1A%40mail.gmail.com.

