Deleting unused Facts in MicroStrategy

I was searching a technote for a friend about distinct not apearing in the SQL (not something to do True Key, sadly) with the and landed up with this interesting technote which I’m going to implment for my current project sometime. We can’t use Object Manager to find this even though there is specific feature to do it as Tables are considered (logically) dependent on Facts. [Can anyone from MicroStrategy explain why is that? It should be other way round.]

Luckily it is simple but you need to have Select access on Metadata. Just run following query against your metadata database and your would get the list of afacts not used by any metric. Also, your would need to run it for each project your have. :(

SELECT object_id,
       object_name
FROM   dssmdobjinfo
WHERE  object_type = 13
       AND project_id = <Project ID> 
       AND object_id NOT IN (SELECT DISTINCT depn_objid AS object_id
                             FROM   dssmdobjdepn
                             WHERE  project_id =??
                                    AND depnobj_type = 13
                                    AND object_type = 4)
ORDER  BY object_id ASC

Disclaimer: Running a unmanaged SQL query against Metadata is not guranteed by MicroStrategy, Inc.