The query that takes 5sec is:
in:
dotlrn_community::list_possible_subcomm_users -subcomm_id subcomm_id
called:
dotlrn_community::list_possible_subcomm_users.select_possible_users
select dotlrn_member_rels_approved.rel_id,
dotlrn_member_rels_approved.rel_type,
dotlrn_member_rels_approved.role,
dotlrn_member_rels_approved.user_id,
acs_users_all.first_names,
acs_users_all.last_name,
acs_users_all.email
from acs_users_all,
dotlrn_member_rels_approved,
dotlrn_communities
where dotlrn_communities.community_id = :subcomm_id
and dotlrn_communities.parent_community_id = dotlrn_member_rels_approved.community_id
and acs_users_all.user_id = dotlrn_member_rels_approved.user_id
and acs_users_all.user_id not in (select dm.user_id
from dotlrn_member_rels_full dm
where dm.community_id = :subcomm_id)
order by last_nam