QUERY PLAN
Aggregate (cost=765.48..765.49 rows=1 width=48)
-> Unique (cost=764.34..764.99 rows=13 width=119)
-> Sort (cost=764.34..764.37 rows=13 width=119)
Sort Key: r.id, r.title, r.status, r.overtime_start, r.overtime_end, 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, r.minutes, r.client_id, r.project_id
-> Group (cost=212.75..764.10 rows=13 width=119)
Group Key: r.id
-> Merge Left Join (cost=212.75..383.56 rows=152215 width=119)
Merge Cond: (r.id = crvr.punch_overtime_id)
-> Merge Left Join (cost=144.93..162.23 rows=2040 width=119)
Merge Cond: (r.id = rccr.punch_overtime_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))
-> Merge Left Join (cost=2.39..2.47 rows=13 width=123)
Merge Cond: (r.id = rvr.punch_overtime_id)
-> Sort (cost=1.37..1.40 rows=13 width=119)
Sort Key: r.id
-> Seq Scan on tbl_punch_overtimes r (cost=0.00..1.13 rows=13 width=119)
-> Sort (cost=1.02..1.02 rows=1 width=8)
Sort Key: rvr.punch_overtime_id
-> Seq Scan on tbl_punch_overtime_verify_rels rvr (cost=0.00..1.01 rows=1 width=8)
-> Sort (cost=142.54..147.64 rows=2040 width=8)
Sort Key: rccr.punch_overtime_id
-> Seq Scan on tbl_punch_overtime_carbon_copy_rels rccr (cost=0.00..30.40 rows=2040 width=8)
-> Sort (cost=67.82..70.25 rows=970 width=4)
Sort Key: crvr.punch_overtime_id
-> Seq Scan on tbl_punch_overtime_cancel_verify_rels crvr (cost=0.00..19.70 rows=970 width=4)