# How Large Does My Database Need to Be?

When Salesforce says your instance uses 4.2GB of table space and 100.8GB of file space, how much space should you allocate for your CopyStorm Salesforce backup database?

This is a harder question than it appears because Salesforce computes used space differently than databases. This article describes Capstorm’s guidelines for computing space requirements for CopyStorm databases.

## Space Hogs Salesforce Does Not Count

Salesforce does not appear to count the cost of indexes when it reports used space. The space used by indexes can add up quickly in a relational database. For example, on SQL/Server we have learned:

* The core indexes CopyStorm needs to work incrementally plus the primary key index take around 15.25MB per 100,000 table rows.
* Each index on a reference field takes around 4.3MB per 100,000 table rows.

In practice, nearly all Salesforce tables contain at least two reference fields (CreatedById and LastModifiedById), and many also contain OwnerId. It is not uncommon for a table to contain 10 or more reference fields.

In summary, for every 100,000 rows you can expect to need at least this much space for indexes where is always at least 3 and usually much larger:

* 15.25M + \*4.3MB

Once CopyStorm has built a schema and before any data has been copied, you can guess the amount of space required for indexes with a bit of SQL. Note: In each example, you must substitute “NumberOfRows” with the actual number of rows in Salesforce.

* SQL/Server: SELECT ((SELECT (15.24 + (4.12\*COUNT(\*))) FROM CopyForceTableField WHERE tableName=’Account’ and fieldType=’reference’)\*(NumberOfRows)/100000.0)
* Oracle: SELECT ((SELECT (15.24 + (4.12\*COUNT(\*))) FROM CopyForceTableField WHERE tableName=’Account’ and fieldType=’reference’)\*(NumberOfRows)/100000.0) FROM DUAL
* PostgreSQL: SELECT ((SELECT (15.24 + (4.12\*COUNT(\*))) FROM CopyForceTableField WHERE tableName=’Account’ and fieldType=’reference’)\*(NumberOfRows)/100000.0)
* MySQL: SELECT ((SELECT (15.24 + (4.12\*COUNT(\*))) FROM CopyForceTableField WHERE tableName=’Account’ and fieldType=’reference’)\*(NumberOfRows)/100000.0

## Tables With Mysterious Sizes

Any table with a BASE64 column (for example, Attachment and ContentVersion) seem to report much less space usage in Salesforce than in a target database. Often 3-4x more space is needed in a relational database than what is reported in Salesforce.

## Just Tell Me How Big to Size My Database

We have never seen a case where 5x the size reported by Salesforce is too small but this may be overkill for your case. In most cases sizing the Salesforce backup database to be 4x the size of your file storage and 2x the size of your data storage will be sufficient.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://learn.capstorm.com/frequently-asked-questions/installation/how-large-does-my-database-need-to-be.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
