QUERY PLAN
Sort (cost=14.82..14.84 rows=9 width=20)
Sort Key: tbl_departments."order"
-> Hash Join (cost=13.47..14.68 rows=9 width=20)
Hash Cond: (tbl_departments.id = tbl_users.department_id)
-> Seq Scan on tbl_departments (cost=0.00..1.09 rows=9 width=16)
-> Hash (cost=13.35..13.35 rows=9 width=4)
-> HashAggregate (cost=13.26..13.35 rows=9 width=4)
Group Key: tbl_users.department_id
-> Seq Scan on tbl_users (cost=4.89..13.05 rows=84 width=4)
Filter: ((user_status = '1'::type_global_user_status) OR (hashed SubPlan 1))
SubPlan 1
-> Seq Scan on tbl_punch_leave_carbon_copy_rels (cost=0.00..4.89 rows=2 width=4)
Filter: (punch_leave_id = 165)