brabertaser19 brabertaser19 - 7 months ago 73
SQL Question

Mysql Bigint VS Varchar

What is the best for index field, and space token on hard disk/RAM? Biginteger or Varchar(15) ?
I can have for example such index number:

from 10000001 to 45281229703 and higher...

But what is better to choose?
Also on non-indexing field what field type is better?


BIGINT is always 8 bytes, VARCHAR(15) is 1..16 bytes depending on value length, so BIGINT needs less memory on large numnbers, but more memory on small numbers (shorter than 7 digits). Also, BIGINT is faster.