Salient Digital Techno Blog
Ramblings on technology with a dash of social commentary
-
Twitter API Snowflake and MySQL
Posted on November 13th, 2010 2 commentsI’ve been looking at APIs lately, and in particular, the Twitter API.
I managed to stumble into an advanced discussion on the Twitter developer forums about Twitter’s “Snowflake” update. One of the primary changes of the Snowflake update is the use of 64-bit integers for their ID.
As a PHP & MySQL developer interested in learning more about the Twitter API, I want my database schema to be optimized properly.
On this page of the MySQL website, it says, in part:
Some things you should be aware of with respect to
BIGINT
columns:- All arithmetic is done using signed
BIGINT
orDOUBLE
values, so you should not use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting aBIGINT
value to aDOUBLE
.
Does that mean I cannot use a BIGINT to store a Tweet’s primary key?
Surely VARCHAR(64) will be much slower…
- All arithmetic is done using signed