This query (from the trigger acs_objects_context_id_up_tr, defined in acs-kernel/sql/oracle/acs-objects-create.sql):
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);
Is very slow on one of our systems, which has almost 2 million rows in the acs_object_context_index table. It takes about 3 minutes to run.
acs_object_contexts is a view into acs_object_context_index, so this can be simplified a bit by rewriting without that view, but presumably the optimizer is already doing that.
This query *looks* like it should be possible to rewrite it to eliminate the sub-selects, but when I try I end up with my head spinning. This kind of tuning is not my forte, unfortunately. Suggestions?
Thanks in advance!