Regarding your query for XoWIKI zombie entries this is what I had to run:
# Set context objects to null
update acs_objects set context_id = NULL where context_id in (select object_id from acs_objects left join cr_items on acs_objects.object_id = cr_items.item_id where object_type = 'content_item' and cr_items.item_id is null);
# Delete zombie entries
delete from acs_objects where object_id in (select object_id from acs_objects left join cr_items on acs_objects.object_id = cr_items.item_id where object_type = 'content_item' and cr_items.item_id is null order by object_id desc);
We do use CR for a lot in our ]project-open[ enhancements, so your initial query ran.... too long 😊.