skip to Main Content

PERFORMANCE Calling multiple times a posgres db to get filtered queries vs querying all objects and filtering in my django view – Postgresql

I'm working in a Django project and it has a postgreSQL db. I'm calling multiple times the model to filter the results: latest = Product.objects.all().order_by('-update_date')[:4] best_rate = Product.objects.all().order_by('rating')[:2] expensive = Product.objects.all().order_by('-price')[:3] But I wonder if it's better for performance and…

VIEW QUESTION
Back To Top
Search