I have a table whose size I'd like to keep down, and one of the columns can be treated as a 5-byte unsigned integer. This is a column that I won't need to search by.
MySQL offers integer datatypes
TINYINT
, for 1-byte integersSMALLINT
, for 2-byte integersMEDIUMINT
, for 3-byte integersINT
, for 4-byte integersBIGINT
, for 8-byte integers.
But it also offers BIT(M)
, for 1 ≤ M ≤ 64. This stores (effectively) an unsigned integer from 0 to 2M-1. Is there a reason to avoid using a BIT(40)
column to store a 5-byte integer? (As I said, I will not need to search by this column. Any difficulties relating to query execution speed may therefore be ignored.)