In the first article we discussed using SQL to determine the size of the Attachments in the database.
My friend Aron Fischman shared with me similar queries using FetchXml:
<!--Email Attachment File Size Analysis--> <fetch distinct='false' mapping='logical' aggregate='true'> <entity name='activitymimeattachment'> <attribute name='activitymimeattachmentid' alias='EmailAttachmentCount' aggregate='count'/> <attribute name='filesize' alias='FileSizeSum' aggregate='sum'/> <attribute name='filesize' alias='FileSizeAvg' aggregate='avg'/> <attribute name='filesize' alias='FileSizeMax' aggregate='max'/> <attribute name='filesize' alias='FileSizeMin' aggregate='min'/> </entity> </fetch> <!--Annotation File Size Analysis--> <fetch distinct='false' mapping='logical' aggregate='true'> <entity name='annotation'> <attribute name='annotationid' alias='AnnotationCount' aggregate='count'/> <attribute name='filesize' alias='FileSizeSum_bytes' aggregate='sum'/> <attribute name='filesize' alias='FileSizeAvg_bytes' aggregate='avg'/> <attribute name='filesize' alias='FileSizeMax_bytes' aggregate='max'/> <attribute name='filesize' alias='FileSizeMin_bytes' aggregate='min'/> </entity> </fetch>