The ObjectQuery is taking too long.
Following is the QueryPlan for the actual Query. Please suggest any improvements that can be made.
group input collection temp collection defined as
for q2 in (Users ObjectMap using UNIQUE INDEX key=( ?1) AND_Collection Users ObjectMap using INDEX on DELETED = (false))
for q3 in userroles ObjectMap using INDEX on USER_ID = ( q2.id)
for q4 in ( (roleaccounts ObjectMap using INDEX on ROLE_ID = ( q3.getRoleId()) AND_Collection roleaccounts ObjectMap using INDEX on ACCOUNT_ID = ( ?2))
AND_Collection roleaccounts ObjectMap using RANGE INDEX on ACCOUNT_PERMISSION_ID with range(,999))
filter ((((( q3.getUserId() = q2.id ) AND ( q4.getRoleId() = q3.getRoleId() ) ) AND ( q4.getAccountId() = ?2 ) ) AND ( q2.deleted = false ) ) AND (
q4.getAccountPermissionId() < 999 ) )
returning new Tuple( q4.getAccountPermissionId() )
This is going to be slow unless you can establish a relationship between the objects and then use the join keyword with dot path navigation. Using = joins can be expensive. Any JPA or EJB 3 book can help you craft a good join/navpath expression.
Tags
Use the search field to
find all types of content in My developerWorks with that tag.
Use the slider bar to see more or fewer tags.
Popular tags shows the top tags for this particular type of content or application that you're viewing.
My tags shows your tags for this particular type of content or application that
you're viewing.