What's the best column type for Google+ User ID?

if the length of the google id is predictable, use a static char(length), add an index on it and create an (internal) integer primary key. Inside of your application you map the data to the integer primary key. So if someone searches by google id, you lookup the integer primary key for this google id and do the rest of your queries with the integer primary key.

So the schema looks like:

Mapping Table:

id (integer) | google_id (char(length)) 

So if you create another table like comments etc, use the primary key id, if you want to lookup all comments for a certain googleid, get the internal id first and then join the comments. This way you have only one query criteria on a static, indexed char field with a predictable length, all other joins and queries will use the integer key.


I would use the same as I do with Facebook: varchar.


I cannot find official recommendation from google but i use of decimal 21,0 works correctly.