QUERY PLAN
Sort (cost=22.56..22.71 rows=62 width=10)
Sort Key: d."order"
-> HashAggregate (cost=20.09..20.71 rows=62 width=10)
Group Key: u.id, d.id
-> Hash Left Join (cost=1.20..19.78 rows=62 width=10)
Hash Cond: (u.department_id = d.id)
-> Seq Scan on tbl_users u (cost=0.00..18.34 rows=62 width=8)
Filter: (id = ANY ('{5088,5082,5252,1000,1023,5359,5300,5329,5304,1020,5248,1017,5102,5125,5124,5358,1003,5247,5030,5089,1013,5135,5332,5413,5446,5209,5029,5250,5087,5298,5072,5074,5360,5026,5388,5364,1022,5015,1011,1006,5249,5445,5016,1008,5096,1005,1004,5085,1016,5296,1015,5104,5295,5064,5208,1014,5309,5076,1001,5299,5101,5023}'::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)