Administrators may observe significant discrepancies between the number of ContentDocument records returned by SOQL queries and the ContentBody record count displayed on the Storage Usage page, leading to confusion about actual file storage consumption and difficulty in managing storage quotas.
SOQL queries on ContentDocument or ContentVersion return significantly fewer records than expected.
Storage Usage page displays much higher ContentBody counts
Sum of individual user storage in "Top Users by File Storage Usage" does not match total file storage usage
Administrators cannot locate or access all files that contribute to storage consumption through standard SOQL queries
This behavior is working as designed due to fundamental differences between SOQL query capabilities and storage calculation algorithms used by the Storage Usage page. The Storage Usage page uses algorithms that account for all ContentBody usage across multiple platform features and not just ContentVersion records. ContentBody storage includes data from various sources beyond traditional file uploads:
ContentVersion records
ContentReference records (images and files in Rich Text fields)
ContentNote records (which internally use Rich Text fields)
Feed posts with embedded images and rich content
Other platform features that utilize blob storage
SOQL Query Limitations:
SOQL queries on ContentDocument and ContentVersion only return files that are directly accessible to the querying user
Simple COUNT() queries cannot replicate the complex storage calculations performed by the platform
SOQL queries do not account for all sources of ContentBody usage across the platform
The discrepancy between SOQL results and Storage Usage calculations is expected behavior. The Storage Usage page provides the authoritative view of actual storage consumption across all platform features, while SOQL queries show only a subset of accessible files.
Use Storage Usage Page as Primary Reference
Rely on the Storage Usage page for accurate storage consumption metrics
Focus on the "Top Users by File Storage Usage" section to identify high-usage users
Use the detailed user storage breakdown to prioritize cleanup efforts
Enable Proper File Access Permissions
Ensure administrators have the "Query All Files" permission enabled
Remove "Query Non Vetoed Files" permission from human user profiles (this permission should only be used for system integrations)
Verify that administrators can access files across all libraries and sharing boundaries
Comprehensive File Cleanup Strategy
Target high-usage users identified in the Storage Usage page
Clean up Rich Text field content that may contain embedded images
Review and clean up Chatter feed posts with attachments
Use "Login As" functionality to access individual user files when necessary
Focus on ContentNote cleanup if extensive note-taking features are used
Alternative Query Approaches
Query by CreatedById or OwnerId to find files created/owned by specific users
Access individual user storage details through the Storage Usage page links
005224377

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.