QUERY PLAN
Aggregate (cost=151.07..151.08 rows=1 width=8)
-> Nested Loop (cost=143.03..151.06 rows=1 width=0)
-> Group (cost=142.74..142.75 rows=1 width=4)
Group Key: r.id
-> Sort (cost=142.74..142.75 rows=1 width=4)
Sort Key: r.id
-> Nested Loop (cost=0.28..142.73 rows=1 width=4)
-> Seq Scan on tbl_reimbursement_settle_rels rsr (cost=0.00..134.19 rows=1 width=4)
Filter: (user_id = 1001)
-> Index Scan using tbl_reimbursements_pkey on tbl_reimbursements r (cost=0.28..8.30 rows=1 width=4)
Index Cond: (id = rsr.reimbursement_id)
Filter: (status = 2)
-> Index Only Scan using tbl_reimbursements_pkey on tbl_reimbursements (cost=0.28..8.30 rows=1 width=4)
Index Cond: (id = r.id)