It’s important to regularly check how much storage space you have in your Salesforce org. Exceeding your storage limit will slow performance and force you to consider costly storage upgrades or removing data quickly. Staying on top of your storage will ultimately help your company save money and maintain optimal performance in your org.
How to check your storage usage in Salesforce
Your org’s storage limit is based on a number of factors, and is calculated differently depending on the edition of Salesforce you are using. In this post, we’ll cover a few different ways to check your Salesforce storage, including checking on a one-off basis, setting up automated monitoring and tracking your storage usage over time.
One-off checks
If you just want to know how much storage your organization is using right now, doing a one-off check is the easiest way to find out.
Storage Usage page in Setup: From your organization’s Setup page, search “Storage Usage” in the Quick Find box.
From here, you’ll be able to see your organization’s storage limits for Data Storage, File Storage and Big Object Storage, and how much of each has been used so far. Scroll down a bit further and you’ll find a breakdown of your current storage usage for each standard and custom object, along with their record count, and how much data each object is using both in absolute terms and as a percentage of your overall limit.
Using Apex to check your current storage usage: If you typically spend your time in the Developer Console, you can also check your storage usage using Apex by running the below query in the Developer Console.
To fetch your usage and limit, use this query:
Map<String,System.OrgLimit> limitsMap = OrgLimits.getMap();
System.OrgLimit fileStorage = limitsMap.get('FileStorageMB');
System.debug('Limit Name: ' + fileStorage.getName());
System.debug('Usage Value: ' + fileStorage.getValue());
System.debug('Maximum Limit: ' + fileStorage.getLimit());
To fetch this amount as a percentage, you can use this query:
PageReference objPageRef = new PageReference('/setup/org/orgstorageusage.jsp?id=' + UserInfo.getOrganizationId() + '&setupid=CompanyResourceDisk');
String strCompanyInfo = objPageRef.getContent().toString(); String strDataStorage = strCompanyInfo.substringBetween('Data Storage','</td></tr>').replaceAll(' ',' ');
String strDataStoragePercent = strDataStorage.substring(strDataStorage.lastIndexOf( '>' ) + 1);
System.debug('Data Usage % is ' + strDataStoragePercent);
String strFileStorage = strCompanyInfo.substringBetween('File Storage','</td></tr>').replaceAll(' ',' ');
String strFileStoragePercent = strFileStorage.substring(strFileStorage.lastIndexOf( '>' ) + 1);
System.debug('File Usage % is ' + strFileStoragePercent);
Setting up automated monitoring
Adding another manual check to the to do list might not be right for everyone. Instead of going into Salesforce each time you want to check your usage, or running one-off Apex queries, setting up an automated monitoring check can help you stay ahead of storage needs without needing to remember to check your usage. This is best practice as it reduces the risk of getting caught out – you can get ahead of the game and remove data long before you hit limits.
The key here is customization, as what you need from storage notifications will depend entirely on your business. Perhaps you know you’ll need to start thinking about storage solutions when you reach 90% capacity. For organizations with smaller limits or those growing more quickly, 60% might be more helpful.
There are a couple of methods you might use to get these notifications:
- Use a third-party application on the AppExchange. Alert App, for example, lets you configure soft and hard limits to get notified at.
- Use the REST API. Another option is to build a custom solution using the REST API. It’ll take some technical know-how, but might be a good option if you need more customization than what you can get off the shelf.
Benefits of tracking your storage over time
Improved visibility of your Salesforce storage over time introduces a range of benefits. Not only will improved visibility help optimize your organization’s performance, you’ll probably find you’re able to save money on expensive storage space. But how?
Understanding past trends helps you anticipate future ones
Firstly, understanding how your storage has changed over time will help you make more accurate predictions about your future storage needs so you can plan more effectively for future capacity. Once you understand what you might need in future, you can be proactive about implementing a solution. Doing so with plenty of time before you need to buy more Salesforce storage can ensure you identify a suitable and cost-effective solution.
A view over time surfaces the impact of processes in your organization
Secondly, a picture over time will give you better insight into the impacts of different processes in your org, and shine a spotlight on areas where you might be able to save on storage. Perhaps you installed a managed package six months ago that’s very data hungry. It helps to understand the impact of these in the context of your overall business, as it can inform decisions about where you might be able to save on storage.
Knowing what “normal” looks like helps you spot “abnormal”
It’s unlikely that you’ll be able spot any rogue movements in your data with only ad-hoc checks on your storage usage.
Perhaps your storage usage suddenly increased by 2%. By tracking your usage regularly, you can identify when it happened making it easier to troubleshoot the root cause. For example, you might notice that the spike coincided with a change to some automation. Or perhaps a newly installed managed package is generating large amounts of data, which is what nonprofit Cincinnati Works discovered was the culprit in their org.
How to create a storage usage report
With the right technical knowledge, you’ll most likely be able to use Apex and the REST API to build your own custom storage report. It’s beyond the scope of this blog post, but there are all sorts of clever ways to extract the information from Salesforce on a regular basis if you know what you’re looking for. However, if you’re looking for a ready-made option, we’ve built a dashboard to help people track their Salesforce storage over time.
Monitor storage usage over time with Gearset’s data dashboard
Gearset’s data dashboard helps you visualize how your data and file storage has changed over time – saving you from building your own custom storage monitoring process. Gearset also spotlights your top three fastest-growing objects, giving you a clear view of potential objects to archive and helping you determine an impactful archiving strategy.
As well as viewing general trends in your data, you’ll find it easier to spot anomalies. Perhaps the three fastest growing objects aren’t the ones you expected, or you notice a significant jump in your overall trend. Beyond just knowing something unexpected has happened, the ability to see the change in context will provide invaluable clues about what may have been the cause.
Dig even deeper into anomalies with object analysis
For even more granular insight into the changes in your data, object analysis in Gearset’s backup solution can help. From the Backup dashboard, go to Job History and then select the Object Analysis tab. Here, you can see how many records were added, changed or deleted for every object in your backup between each backup run. Tracking changes at the object level is invaluable for pinpointing the source of anomalies with precision and ease.
While the primary use case is to highlight lost data that needs to be restored, backup users find this view of their data can also demonstrate the need to archive data and save storage space.
When Cincinnati Works noticed their data usage had increased significantly, they used Gearset’s object analysis to work out when a particular object had started accumulating data so quickly. They identified that the anomaly coincided with the installation of a third-party app that was generating so much data their org would hit the limit much sooner than expected.
How to clean up and reduce your Salesforce storage
Close to, or exceeded, your data storage limit already? Storage insights are a helpful place to start targeting different areas of your organization for data cleanup. A Salesforce archiving solution is the best way to remove data from production that you can’t lose entirely if, for example, it’s needed for regulatory purposes.
Explore Gearset’s archiving solution and get in touch to arrange a demo tailored for your team’s use cases.