QUERY PLAN
Sort (cost=18.48..18.49 rows=1 width=156)
Sort Key: tbl_departments."order"
-> Nested Loop (cost=10.40..18.47 rows=1 width=156)
-> HashAggregate (cost=10.25..10.26 rows=1 width=4)
Group Key: tbl_users.department_id
-> Seq Scan on tbl_users (cost=0.00..10.25 rows=1 width=4)
Filter: (user_status = '1'::type_global_user_status)
-> Index Scan using tbl_departments_pkey on tbl_departments (cost=0.15..8.17 rows=1 width=152)
Index Cond: (id = tbl_users.department_id)