QUERY PLAN
Sort (cost=15.42..15.50 rows=31 width=10)
Sort Key: d."order"
-> HashAggregate (cost=14.35..14.66 rows=31 width=10)
Group Key: u.id, d.id
-> Hash Left Join (cost=1.20..14.19 rows=31 width=10)
Hash Cond: (u.department_id = d.id)
-> Seq Scan on tbl_users u (cost=0.00..12.87 rows=31 width=8)
Filter: (id = ANY ('{5252,1000,5412,1023,5360,5388,5359,1022,5364,5015,5300,5329,1011,5445,5016,5248,1017,1005,1004,5085,5296,1015,5358,5295,1013,5413,1014,5064,5446,1001,5087}'::integer[]))
-> Hash (cost=1.09..1.09 rows=9 width=6)
-> Seq Scan on tbl_departments d (cost=0.00..1.09 rows=9 width=6)