I'm storing the ID of the Salesforce records we have synced with our website. I am currently using an existing table to store the ID mappings for the records. The problem is that the existing field is BIGINT(19) and the ID I am getting is 18-digit alphanumeric.

I read that it is base-62 encoded, so I tried to convert it to base-10, but the length is too long to be stored in BigInt.

Can someone help me with this? I need to store the ID for updating the records on Salesforce. Is the entire ID a unique representation of the record? Is there a way to store a smaller part of the id and generate the rest to use it when updating the record through REST API.

1 Answer 1


If you've seen this question, you'd know how ID values are used. For now, the portion of the ID that is used is approximately as follows:


Where K is the key prefix, P is the Pod Identifier, R is reserved, U is currently unused portion of the index, and N is the used portion of the index.

If you choose to discard anything, K, R and U would be safe to discard (for now). In the next few years, the 10th character will likely start being used, so as a safety measure (i.e. to avoid a Y2K bug type situation), I'd include that, too. This means you'd calculate it like this:

KKK  RUUU       = Unused portion
   PP    NNNNNN = Used portion

This reduces the necessity to just BIGINT(15).

However, if possible, you really should just use a CHAR(15) and index it. Any solution you use to reduce the characters will probably result in more problems than it will solve.

Edit/Note: the pod identifier is the pod where the record was created, not the pod you're currently on (e.g. if you were migrated, full sandbox copies, etc). It should be considered part of the unique identifier for the record.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .