QUERY PLAN
Sort (cost=13.63..13.68 rows=23 width=10)
Sort Key: d."order"
-> HashAggregate (cost=12.88..13.11 rows=23 width=10)
Group Key: u.id, d.id
-> Hash Left Join (cost=1.20..12.76 rows=23 width=10)
Hash Cond: (u.department_id = d.id)
-> Seq Scan on tbl_users u (cost=0.00..11.46 rows=23 width=8)
Filter: (id = ANY ('{5252,1023,5300,5248,1017,1013,5413,5446,5250,5087,5360,5388,1022,1011,5445,1005,1004,5085,5296,1015,5295,5064,1001}'::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)