Given a tree of related entities, is there a fundamental reason (complexity?) why the CMP engine could not be optimized to perform single statement deletion of child entity rows bottom up?
e2 -> e1 -> e0
delete e2 where e2.e1.e0 = e0
delete e1 where e1.e0 = e0
delete e0
rather than
foreach e1 in e0
__foreach e2 in e1
____delete e2
__delete e1
delete e0
I beleive there are many ways to improve current implementation but could you be more specific?
Could you provide a single SQL statement for this? Note, it should be acceptable by different databases.