Query using reverse relationship or objects manager?

28 views Asked by At
from .models import Comment

user = request.user

comments_1 = user.comment_set.all().count()

comments_2 = Comment.objects.filter(user=user).count()

Between comments_1 and comments_2, which one is faster? Can someone explain to me? Any help will be greatly appreciated. Thank you very much.

I looked in Django Documentation Making queries, but does not really say about the difference in performance.

0

There are 0 answers