skip to Main Content

Index mysql key select

I need help for performance this query SELECT * FROM transactions WHERE created_at BETWEEN '2022-08-25 01:03:21' AND '2022-12-13 01:03:21' AND ((transaction_reason IN ('ORIGINAL','REVERSAL_OF_ADJUSTMENT') AND type = 'DEPOSIT') OR (transaction_reason IN ('ADJUSTMENT','REVERSAL_OF_ORIGINAL') AND type = 'WITHDRAWAL') ) ORDER BY transaction_id ASC…

VIEW QUESTION

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