Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Google+ has very long User IDs

104560124403688998123

(21 characters), which is not possible to input into BIGINT field (not unsigned)

What column type would you use for such IDs ?

I do not think that varchar is good idea

like image 617
genesis Avatar asked Jul 29 '11 11:07

genesis


People also ask

What is required for User-ID in Google Analytics?

What is User ID in Google Analytics? User ID is a unique set of alphanumeric characters (like 987eeetgd) assigned to a user so that he can be identified across devices/ browsers and over the course of multiple sessions.

What is User-ID in Google ads?

user_id is a unique identifier that you internally associate with a certain customer. With this parameter, an advertiser can add a User ID Tag to collect User Lists that are matched to the Google cookie space without providing personally identifiable information (PII) to Google.

How do I set up a Google Analytics User-ID?

Click Variable Configuration > Data Layer Variable. Enter a name for the variable at the top. In the Data Layer Variable Name field, enter a name for your user ID variable (such as "user_id"). Click Save.

Where do I find my Google Analytics User-ID?

Start by going to the Admin view in your Google Analytics account. In the Property section, click on Tracking Info and then on User-ID.


1 Answers

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.

like image 125
sled Avatar answered Sep 20 '22 13:09

sled