13

I was wondering today why google decided to do this for the google plus platform. I know I can handle these id's using varchars in mysql, but it's a bit weird to me why google decided to go for such big integers. An example google plus id is like this: 117634089072667507999

It's a very big integer which is out of the range of unsigned bigint on Mysql. Even with a big integer on mysql, it would take thousands of years to reach the limit of the id though there were millions of users signing in for google plus every second. So my question is, why did google choose such big integers?

Masum
  • 1,678
  • 15
  • 19

1 Answers1

12

Probably to allow them to use non-sequential IDs so that you can't deduce anything by comparing user IDs.

You should store them as strings, since you aren't using them as numbers (just like zip codes or phone numbers).

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
  • hmmm... your argument sounds logical, but why then facebook is not doing so? – Masum Mar 11 '12 at 17:46
  • @Masum: Are you sure Facebook is not doing so? – SLaks Mar 11 '12 at 17:47
  • Facebook id's can be stored in mysql bigint, but not the gplus ones.I thought they are using mysql from the very beginning. Whatever I might be wrong, thanks for your answer – Masum Mar 11 '12 at 17:49
  • 1
    @Masum: That does not necessarily mean that they're sequential. – SLaks Mar 11 '12 at 17:49
  • Yes I do agree with you, it's a good point not to have sequential ids, but gplus id's are insanely big, may be because they are big thinkers :) – Masum Mar 11 '12 at 17:52
  • 1
    First if they were using this number as the real id then they wouldn't be google. This is only the displayable id, not the one really used. Second: if they were "insanely" big for handling that amount of users they would be "insanely stupid", consider this: BIGINT maximum: 18446744073709551615. Seconds in a year: 31536000. With 1M new users per second it would take more than 400k years to fill the DB. NOT to mention that we only have a litte more than 7B people in our planet! – Jake Armstrong Apr 11 '13 at 09:35