Friday, February 12, 2010

Data Types

Storage Requirements for Numeric Types in MyISAM

Data Type Storage Required
TINYINT 1 byte
SMALLINT 2 bytes
MEDIUMINT 3 bytes
INT, INTEGER 4 bytes
BIGINT 8 bytes
FLOAT(p) 4 bytes if 0 <= p <= 24, 8 bytes if 25 <= p <= 53
FLOAT 4 bytes
DOUBLE [PRECISION], REAL 8 bytes
DECIMAL(M,D), NUMERIC(M,D) Varies; see following discussion
BIT(M) approximately (M+7)/8 bytes


Type Bytes Signed(Min/Max) Unsigned(Min/Max)
TINYINT 1 -128/127 0/255
SMALLINT 2 -32768/32767 0/65535
MEDIUMINT 3 -8388608 / 8388607 0/16777215
INT 4 -2147483648 / 2147483647 0/4294967295
BIGINT 8 -9223372036854775808 / 9223372036854775807 0 /18446744073709551615

No comments:

Post a Comment