QUERY PLAN
Unique (cost=835.36..835.46 rows=2 width=118)
-> Sort (cost=835.36..835.37 rows=2 width=118)
Sort Key: (CASE WHEN ((rvr.status = 0) AND (r.next_verify_user = 1001)) THEN 1 ELSE 0 END) DESC, r.id, r.status, r.amount, r.occurrence_at, r.settle_accounts_at, r.settle_accounts_by, r.description, r.created_by, r.created_at, r.updated_at, r.refuse_description, r.client_id, r.project_id, r.is_resubmited, r.work_log_id, r.pre_sales_id, r.implement_record_id
-> Group (cost=835.33..835.35 rows=2 width=118)
Group Key: (CASE WHEN ((rvr.status = 0) AND (r.next_verify_user = 1001)) THEN 1 ELSE 0 END), r.id
-> Sort (cost=835.33..835.33 rows=2 width=118)
Sort Key: (CASE WHEN ((rvr.status = 0) AND (r.next_verify_user = 1001)) THEN 1 ELSE 0 END) DESC, r.id
-> Nested Loop Left Join (cost=404.64..835.32 rows=2 width=118)
-> Nested Loop Left Join (cost=404.35..811.97 rows=2 width=118)
-> Hash Join (cost=404.06..795.33 rows=2 width=118)
Hash Cond: (rvr.reimbursement_id = r.id)
-> Seq Scan on tbl_reimbursement_verify_rels rvr (cost=0.00..362.96 rows=7543 width=8)
Filter: (user_id = 1001)
-> Hash (cost=404.03..404.03 rows=2 width=114)
-> Hash Right Join (cost=266.02..404.03 rows=2 width=114)
Hash Cond: (rsr.reimbursement_id = r.id)
-> Seq Scan on tbl_reimbursement_settle_rels rsr (cost=0.00..118.04 rows=7604 width=4)
-> Hash (cost=266.00..266.00 rows=2 width=114)
-> Seq Scan on tbl_reimbursements r (cost=0.00..266.00 rows=2 width=114)
Filter: ((status <> 0) AND (status <> '0'::smallint) AND (next_verify_user = 1001))
-> Index Only Scan using tbl_term_taxonomy_relationships_object_id_term_id_idx on tbl_term_taxonomy_relationships dt1 (cost=0.29..8.31 rows=1 width=4)
Index Cond: ((object_id = r.id) AND (term_id = 15))
-> Index Scan using tbl_term_taxonomy_relationships_object_id_term_id_idx on tbl_term_taxonomy_relationships dt2 (cost=0.29..11.66 rows=1 width=4)
Index Cond: ((object_id = r.id) AND (term_id = 18))
Filter: (object_type = 7)