I have attached here one query analyze the result, https://explain.depesz.com/s/x9BN
This is the query
EXPLAIN ANALYZE
SELECT
branches.id as branch_id,
date(products.created_at + interval '1 hours 0 minutes') as date,
SUM(total_amount) as totalamount
FROM "products"
INNER JOIN "branches" ON "branches"."id" = "products"."branch_id"
WHERE (products.order_status_id NOT IN (10, 5, 50))
AND (products.company_id = 190)
AND (
products.created_at
BETWEEN '2019-01-30 23:00:00.000000'
AND '2019-12-30 23:00:00.000000'
)
GROUP BY branches.id, date;
where I can see more time takes in the usage of NOT IN()
.
Is there any other function we can use to increase the performance.