What is the datatype of facebook userid

前端 未结 2 1728
清歌不尽
清歌不尽 2021-02-07 10:46

What datatype facebook uses to store userid, what should be that best data type for such field performance and scalability perspective.

If one uses int 4 bytes then i gu

相关标签:
2条回答
  • 2021-02-07 11:17

    Use BIGINT(64) to store Facebook User IDs in MySQL Database Table.
    Here you go: https://developers.facebook.com/blog/post/45/

    0 讨论(0)
  • 2021-02-07 11:33

    Good question. Facebook IDs can lead to problems as well as Tweet IDs. Both exceed the 32bit integer range. Depending on programming language specifics and the purpose (e.g. database, code, etc.) you may want to use float or double but in my experience casting them to string is satisfactory.

    In MySQL, as tagged, provided is the BIGINT data type, which is large enough to store these IDs as numbers. The tricky part is when you read these values and process them in your program code. Those that are greater than the maximum allowed by system architecture / programming language may cause errors or be truncated leading to inconsistency.

    If you want to use fixed length large IDs in MySQL, a good practice is to use the CHAR type and HEX format or you can use the UUID format.

    0 讨论(0)
提交回复
热议问题