How the Hell Is Salesforce Computing Data Consumption?

Q: “How the Hell is Salesforce computing data consumption?”

A: Let’s start with the basics:

. . . but the short takeaway is “each record is assumed to take up 2 KB”.

This is kinda cool–a record can obviously take up a heckuva lot more than 2 KB. In my company’s org, the long text fields alone could consume more than 1.5 MB of storage for a single record.

There are a couple of weird wrinkles, like junction objects. . .

  • Campaign Members, Opportunity Splits, and Case Team Members DO count against storage.
  • Account and Opportunity Team Members DON’T.

Campaigns. . .

  • each Campaign counts for 8 KB of storage.

Historical Trending. . .

  • each Historical Trending record counts for 1 KB of storage.

and Email Messages’ actual size is computed in determining consumption.

If, like me, you wanted to try replicating Storage Usage’s “Storage” column in, say, a spreadsheet: wonder no more!

If you copy the four columns of the Storage Usage table into a Google Sheet, here’s the Google Sheets formula that will replicate Salesforce’s “Storage” column:

=IFS(A2="Email Messages",
        TEXT(B2,"#,##0"" recs"""),
        IFS(B2*8<1024,TEXT(B2*8,"#,##0 ""KB"""),
            B2*8<1048576,TEXT(B2/1024*8,"#,##0.0 ""MB"""),
            B2*8<1073741824,TEXT(B2/1048576*8,"#,##0.0 ""GB""")),
     OR(A2="Campaign Members",NOT(ISERR(FIND("(Historical)",A2)))),
           IFS(B2<1024,TEXT(B2,"#,##0 ""KB"""),
               B2<1048576,TEXT(B2/1024,"#,##0.0 ""MB"""),
               B2<1073741824,TEXT(B2/1048576,"#,##0.0 ""GB""")),
     B2>0,IFS(B2*2<1024,TEXT(B2*2,"#,##0 ""KB"""),
               B2*2<1048576,TEXT(B2/1024*2,"#,##0.0 ""MB"""),
               B2*2<1073741824,TEXT(B2/1048576*2,"#,##0.0 ""GB""")),
     B2=0,"0 B")

Two notes:

  • this formula assumes “Record Type” was pasted into column A and “Record Count” was pasted into column B.
  • I can’t give you the consumption of Email Messages, alas–it depends on the actual size of the records, which couldn’t be broken down further without, say, downloading EmailMessage via a tool like Workbench or Data Loader.

If you just wanted to know how many bytes Salesforce claims you’re taking up:

=IFS(A2="Email Messages", TEXT(B2,"#,##0"" recs"""),
     A2="Campaigns", B2*1024*8,
     OR(A2="Campaign Members",NOT(ISERR(FIND("(Historical)",A2)))), B2*1024,
     A2<>"", B2*1024*2)

The same two notes from above apply to these formula as well.

If you want to just turn the KBs, MBs, and GBs into (approximate) bytes:

=IFS(RIGHT(C2, 2)="GB", VALUE(LEFT(C2, FIND(" ", C2)-1))*1024*1024,
     RIGHT(C2, 2)="MB", VALUE(LEFT(C2, FIND(" ", C2)-1))*1024,
     1=1, VALUE(LEFT(C2, FIND(" ", C2)-1)))

Nice to know that Salesforce is computing its Kilobytes, Megabytes, and Gigabytes honestly, using 1024, 10242, and 10243, and not just slapping zeroes after 1024!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s