django-queryset-4

Last Updated :
Discuss
Comments

When using order_by('created') on a comments queryset, what is the default sort direction and how can this relate to query efficiency?

Ascending and always causes a full table scan

Descending and requires reverse() for ascending

Ascending which shows oldest first and can use an index on the field for efficient sorting

Random with no index impact

Tags:
Share your thoughts in the comments