QUERY PLAN
HashAggregate (cost=9.66..9.75 rows=9 width=4)
Group Key: u.department_id
-> Hash Right Join (cost=1.49..9.62 rows=19 width=4)
Hash Cond: (u.id = psrr.user_id)
-> Seq Scan on tbl_users u (cost=0.00..7.41 rows=141 width=8)
-> Hash (cost=1.25..1.25 rows=19 width=4)
-> Seq Scan on tbl_punch_strategy_resource_rels psrr (cost=0.00..1.25 rows=19 width=4)
Filter: ((user_id IS NOT NULL) AND (punch_strategy_id <> 2))