QUERY PLAN
Aggregate (cost=30.84..30.85 rows=1 width=48)
-> Unique (cost=29.85..30.39 rows=12 width=99)
-> Sort (cost=29.85..29.88 rows=12 width=99)
Sort Key: r.id, r.day_at, r.title, r.status, r.repair_type, r.repair_time, r.next_verify_user, r.verify_at, r.next_cancel_verify_user, r.cancel_at, r.description, r.refuse_description, r.is_resubmited, r.created_by, r.created_at, r.updated_at, r.cancel_description
-> Group (cost=29.51..29.63 rows=12 width=99)
Group Key: r.id
-> Merge Left Join (cost=29.51..29.60 rows=12 width=99)
Merge Cond: (r.id = crvr.punch_repair_id)
-> Sort (cost=28.43..28.46 rows=12 width=99)
Sort Key: r.id
-> Hash Right Join (cost=20.38..28.22 rows=12 width=99)
Hash Cond: (rccr.punch_repair_id = r.id)
Filter: ((r.created_by = ANY ('{1000,1001,1004,1005,1011,1013,1015,1017,1022,1023,5016,5064,5085,5087,5248,5250,5252,5295,5296,5300,5311,5329,5332,5360,5388,5404,5420,5440,5445,5446}'::integer[])) OR (rccr.user_id = 1000) OR (rvr.user_id = 1000))
-> Seq Scan on tbl_punch_repair_carbon_copy_rels rccr (cost=0.00..5.33 rows=333 width=8)
-> Hash (cost=20.18..20.18 rows=16 width=103)
-> Hash Right Join (cost=14.93..20.18 rows=16 width=103)
Hash Cond: (rvr.punch_repair_id = r.id)
-> Seq Scan on tbl_punch_repair_verify_rels rvr (cost=0.00..4.25 rows=225 width=8)
-> Hash (cost=14.73..14.73 rows=16 width=99)
-> Hash Join (cost=7.86..14.73 rows=16 width=99)
Hash Cond: (r.created_by = u.id)
-> Seq Scan on tbl_punch_repairs r (cost=0.00..6.25 rows=225 width=99)
-> Hash (cost=7.74..7.74 rows=10 width=4)
-> Seq Scan on tbl_users u (cost=0.00..7.74 rows=10 width=4)
Filter: (department_id = 4)
-> Sort (cost=1.08..1.09 rows=4 width=4)
Sort Key: crvr.punch_repair_id
-> Seq Scan on tbl_punch_repair_cancel_verify_rels crvr (cost=0.00..1.04 rows=4 width=4)