Automated Detached Media Cleanup
Introduction In Business Central, there are two ways to store files. Either as Blobs or as Media types. In Media types, we store the files in the database (Tenant Media ID - 2000000184) and then we refer this record in other tables. Whenever there are no records referring a Media, it is deleted from the database. Media types are much more performant as they support caching whereas BLOBs needs to be fetched from the SQL Server every time they are used. Microsoft has moved most of the fields from using Blobs to Media types. However, in scenarios with a high load of writes and deletes, it is possible that there may end up orphaned media records i.e. Media records that are not referenced anywhere. In order to tackle such cases, Microsoft has recently announced the FindOrphans procedure which would return a list of GUIDs of such orphaned Media Types which could then we dealt with as needed. There’s also another tool that has been provided by Microsoft which uses this newly added procedures