Forum OpenACS Development: Permission context_id slowness

Collapse
Posted by Barry Books on
I have a need to change the context_id of objects in a workflow in order to change permissions. This now takes several seconds to do. I've found there is a trigger to manage acs_object_context_index and the query
  -- Remove my old ancestors from my descendants.
  delete from acs_object_context_index
  where object_id in (select object_id
                      from acs_object_contexts
                      where ancestor_id = :old.object_id)
  and ancestor_id in (select ancestor_id
		      from acs_object_contexts
		      where object_id = :old.object_id);
takes a very long time. I've changed it to
for x in ( selecct object_id from acs_object_contexts where 
ancestor_id = :old.object_id) loop
delete from acs_object_context_index
where object_id = x.object_id
and ancestor_id in ( select ancestor_id from acs_object_contexts
                        where object_id = :old.object_id );
end loop;

This seems to run instantly. ( from sqlplus ). My first question is do the two do the same thing? The in and in clause confuses me a little ( and apparently Oracle also ). I assume any combination of object_id's and ancestor_id's will match.

My second questions is assuming the above do the same thing is this a problem in acs 4.5 (I'm running 4.2) and if so this might be a nice patch.