QUERY PLAN
Sort (cost=25.05..25.09 rows=16 width=10)
Sort Key: d."order"
-> Group (cost=24.61..24.73 rows=16 width=10)
Group Key: u.id, d.id
-> Sort (cost=24.61..24.65 rows=16 width=10)
Sort Key: u.id, d.id
-> Hash Left Join (cost=1.20..24.29 rows=16 width=10)
Hash Cond: (u.department_id = d.id)
-> Seq Scan on tbl_users u (cost=0.00..23.03 rows=16 width=8)
Filter: ((user_status = '1'::type_global_user_status) AND ((id = ANY ('{1000,1001,1004,1005,1011,1013,1015,1017,1022,1023,5016,5064,5085,5087,5248,5250,5252,5295,5296,5300,5311,5329,5332,5360,5388,5404,5420,5440,5445,5446}'::integer[])) OR (id = ANY ('{5088,5082,5252,1000,1023,5359,5300,5329,5304,1020,5248,1017,5102,5125,5124,5358,1003,5247,5089,1013,5135,5332,5413,5209,5029,5087,5298,5072,5074,5360,5026,5388,5364,1022,5015,1011,1006,5249,5445,5016,1008,5096,1005,1004,5085,1016,5296,1015,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)