QUERY PLAN
Aggregate (cost=3947.08..3947.09 rows=1 width=200)
-> Unique (cost=3861.89..3901.37 rows=831 width=118)
-> Sort (cost=3861.89..3863.97 rows=831 width=118)
Sort Key: r.id, r.status, r.amount, r.occurrence_at, r.settle_accounts_at, r.settle_accounts_by, r.description, r.created_at, r.updated_at, r.refuse_description, r.client_id, r.project_id, r.next_verify_user, r.is_resubmited, r.work_log_id, r.pre_sales_id, r.implement_record_id, (CASE WHEN (r.status = 2) THEN 1 ELSE 0 END)
-> HashAggregate (cost=3811.21..3821.60 rows=831 width=118)
Group Key: r.id
-> Hash Right Join (cost=2321.01..3806.67 rows=1814 width=114)
Hash Cond: (dt2.object_id = r.id)
-> Seq Scan on tbl_term_taxonomy_relationships dt2 (cost=0.00..1470.03 rows=2196 width=4)
Filter: ((term_id = 18) AND (object_type = 7))
-> Hash (cost=2298.34..2298.34 rows=1814 width=114)
-> Hash Left Join (cost=1816.04..2298.34 rows=1814 width=114)
Hash Cond: (r.id = rccr.reimbursement_id)
Filter: ((r.created_by = ANY ('{1000,1001,1004,1005,1011,1013,1015,1022,1023,5016,5064,5085,5087,5248,5250,5252,5295,5300,5311,5332,5360,5446,5461,5476}'::integer[])) OR (rccr.user_id = 1001) OR (rsr.user_id = 1001) OR (rvr.user_id = 1001))
-> Hash Right Join (cost=1803.05..2263.30 rows=2205 width=122)
Hash Cond: (rvr.reimbursement_id = r.id)
-> Seq Scan on tbl_reimbursement_verify_rels rvr (cost=0.00..354.43 rows=22343 width=8)
-> Hash (cost=1792.66..1792.66 rows=831 width=118)
-> Hash Right Join (cost=444.62..1792.66 rows=831 width=118)
Hash Cond: (dt1.object_id = r.id)
-> Seq Scan on tbl_term_taxonomy_relationships dt1 (cost=0.00..1308.03 rows=8476 width=4)
Filter: (term_id = 15)
-> Hash (cost=434.23..434.23 rows=831 width=118)
-> Hash Right Join (cost=281.78..434.23 rows=831 width=118)
Hash Cond: (rsr.reimbursement_id = r.id)
-> Seq Scan on tbl_reimbursement_settle_rels rsr (cost=0.00..130.31 rows=8431 width=8)
-> Hash (cost=271.39..271.39 rows=831 width=114)
-> Seq Scan on tbl_reimbursements r (cost=0.00..271.39 rows=831 width=114)
Filter: ((status <> 0) AND (created_by = 5295))
-> Hash (cost=7.44..7.44 rows=444 width=8)
-> Seq Scan on tbl_reimbursement_carbon_copy_rels rccr (cost=0.00..7.44 rows=444 width=8)