Salesforce 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. This leads to confusion about actual file storage consumption and difficulty managing storage quotas.
For example, an administrator may run SELECT COUNT() FROM ContentDocument and receive 50,000 records, while the Storage Usage page shows 80,000 ContentBody records. This difference is expected — the additional records originate from platform features like ContentNote records, embedded images in Rich Text fields (ContentReference), and Chatter feed posts with attachments that are not accessible via standard ContentDocument SOQL.
This behavior is working as designed. The Storage Usage page uses algorithms that account for all ContentBody usage across multiple platform features — not just ContentVersion records. ContentBody storage includes data from the following sources:
SOQL Query Limitations:
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.
1. Use Storage Usage Page as Primary Reference
2. Enable Proper File Access Permissions
3. Comprehensive File Cleanup Strategy
4. Alternative Query Approaches
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.