Speed up the `clean_up_reference` function
The current implementation of the clean_up_reference
-function searches for all orphan datasets in AssetReference
(all datasets that point to non-existing datasets in EntityReference
). Thus, this function should rather be called remove_orphan_reference_assets
and the clean_up_reference
-function should be changed to first remove all reference assets for the selected reference entities and then subsequently remove the reference entities. This should speed up the process because not all reference assets need to left-joined with reference entities.
Edited by Danijel Schorlemmer