Facebook user_id : big_int, int or string?

前端 未结 8 925
忘掉有多难
忘掉有多难 2020-12-13 08:41

Facebook\'s user id\'s go up to 2^32 .. which by my count it 4294967296.

mySQL\'s unsigned int\'s range is 0 to 4294967295 (which is 1 short - or my math is wrong) a

8条回答
  •  有刺的猬
    2020-12-13 09:07

    Because Facebook assigns the IDs, and not you, you must use BIGINTs.

    Facebook does not assign the IDs sequentially, and I suspect they have some regime for assigning numbers.

    I recently fixed exactly this bug, so it is a real problem.

    I would make it UNSIGNED, simply because that is what it is.

    I would not use a string. That makes comparisons painful and your indexes clunkier than they need to be.

提交回复
热议问题