My question is more advisory than technical.
I\'m writing a Facebook app in which I am fetching some information about the user, including facebook_id.
I was wondering i
For new data types, as they are grahp obj ID, I believe it is safe to save them as BINT. However, for old "id", e.g. pic, save them as string (you can easily see that they are in the format xxxxxx_xxxxxxxx)
Although unlikely, facebook could change the format of their ID's, so to make it future proof, I'd use a varchar.
similar question to: Facebook user_id : big_int, int or string?
"I would not use a string. That makes comparisons painful and your indexes clunkier than they need to be."
Use BIGINT(64) to store Facebook User IDs.
Here you go: https://developers.facebook.com/blog/post/45/
Facebook uses 64-bit integers (bigint) for their user ids. So you use Bigint UNSIGNED in MySQL.
"As a reminder, in the very near future, we will be rolling out 64 bit user IDs. We encourage you to test your applications by going to www.facebook.com/r.php?force_64bit and create test accounts with 64 bit UIDs."
Edit: Facebook usernames is not the same thing as the user id. The username is of course varchar but will not be returned as the id.
To quote facebook's upgrade notes regarding graph API v2.0 (effective May 2015):
All IDs are strings. In v1.0, IDs were often large numbers.
Which (to me) implies that userids are not guaranteed to be numbers. In fact, facebook recommend that you use strings:
https://developers.facebook.com/docs/graph-api/reference/v2.2/user#fields
Name:id
Description: id The id of this person's user account.This ID is unique to each app and cannot be used across different apps(...)
type: string
Although I must admit I've never seen an alphanumeric id.