QUERY PLAN
Aggregate (cost=172.89..172.90 rows=1 width=8)
-> Nested Loop (cost=164.85..172.88 rows=1 width=0)
-> Group (cost=164.56..164.57 rows=1 width=4)
Group Key: r.id
-> Sort (cost=164.56..164.57 rows=1 width=4)
Sort Key: r.id
-> Nested Loop (cost=0.29..164.55 rows=1 width=4)
-> Seq Scan on tbl_reimbursement_settle_rels rsr (cost=0.00..150.90 rows=1 width=4)
Filter: (user_id = 1000)
-> Index Scan using tbl_reimbursements_pkey on tbl_reimbursements r (cost=0.29..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.29..8.30 rows=1 width=4)
Index Cond: (id = r.id)