Is 256 a safe max length for a user_id?

I’m creating an index in my DB for the Auth0 user_id:

I’m using Facebook, Instagram, and Google as providers. 256 should be long enough, right?

I guess so but let me check with the team whether we have any official guidance on that front!

1 Like

Thanks! It’s an index field, so I’m trying to get it as short as possible, but without potential truncations.

I’m guessing a length as low as 64 might even be acceptable, but I suppose it all depends on the values coming back from the identity providers. I’m trying to strike a balance between efficiency and future-proofing. I don’t want to shoot myself in the foot by having an index field length that is too short to hold a potentially long value.

Sure! Let me confirm that with the team!

I managed to get some info back. So basically we don’t have any public guidance on that front however on the not official side of things :smiley: we suggest 32 characters random uuid.

I think you may misunderstand me. I’m not asking for what I should use for an ID. Let me re-frame the question.

For social connections, Auth0 provides a user_id in the form of {identity provider identifier}|{user identifier from identity provider}. For example, a user_id returned for an Instagram account looks like instagram|554106952, and a user_id returned for a facebook account looks like facebook|10157866690664421. As I understand it, these are the unique IDs of users in the Auth0 system.

What I’m asking is: what is a safe database field length for storing these values? Assume that I may add new identity providers in the future. Right now, I’m only using Google, Facebook, and Instagram. But I may add more in the future. So, how long should that field be to accommodate future values. 2 character uuid doesn’t make sense, because the values I’m being passed from Auth0 ae not uuid’s.

If a facebook user_id is 26 characters long, I can’t imagine that any other provider will be much longer than that. So I’m guessing 64 or 128 will probably always be enough. I’ll assume that for now.

1 Like

gotchya now… yep I think you can move with that!

1 Like