QUERY PLAN
Limit (cost=359.28..359.28 rows=1 width=165)
-> Sort (cost=359.28..359.28 rows=1 width=165)
Sort Key: c.updated_at DESC
-> Group (cost=359.26..359.27 rows=1 width=165)
Group Key: c.id
-> Sort (cost=359.26..359.27 rows=1 width=165)
Sort Key: c.id
-> Nested Loop (cost=0.28..359.25 rows=1 width=165)
-> Seq Scan on tbl_case_assignments ca (cost=0.00..202.64 rows=22 width=4)
Filter: ((assignment_status = ANY ('{1,2}'::integer[])) AND (engineer_id = 1001))
-> Index Scan using tbl_cases_pkey on tbl_cases c (cost=0.28..7.03 rows=1 width=165)
Index Cond: (id = ca.case_id)
Filter: (case_status = ANY ('{1,2,3}'::integer[]))