////How Large Does My Database Need to Be?
How Large Does My Database Need to Be? 2018-05-10T20:23:03+00:00

How Large Does My CopyStorm Salesforce Backup 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 <Number of Reference Fields> is always at least 3 and usually much larger:

  • 15.25M + <Number of Reference Fields>*4.3MB

Once CopyStorm has built a schema and before any data has been copied, you can guess the amount of space requried 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.

CONTACTS

Product Questions: info@capstorm.com
Technical Support: support@capstorm.com
Phone: +1 314.403.2143