Skip to main content

Data Types

The following table lists the data types supported by StoneDB.

CategoryData type
IntegerTINYINT, SMALLINT, MEDIUMINT, INT, BIGINT
Floating pointFLOAT, DOUBLE
Fixed pointDECIMAL
Date and timeYEAR, TIME, DATE, DATETIME, TIMESTAMP
StringCHAR, VARCHAR, TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT
Binary stringBINARY, VARBINARY, TINYBLOB, BLOB, MEDIUMBLOB, LONGBLOB

Integer data types

The following table provides the value range of each integer data type.

TypeStorage (Bytes)Minimum Value SignedMinimum Value UnsignedMaximum Value SignedMaximum Value Unsigned
TINYINT1-1280127255
SMALLINT2-3276803276765535
MEDIUMINT3-83886080838860716777215
INT4-2147483647021474836474294967295
BIGINT8-9223372036854775806092233720368547758079223372036854775807

Notice:

For INT type: -2147483648 is reserved to indicate INT_NULL in Tianmu engine, Minimum Value Signed start from -2147483647.

For BIGINT type: -9223372036854775807 is reserved to indicate BIGINT_NULL in Tianmu, Maximum Value Signed start from -9223372036854775806.

For BIGINT type: Maximum Value Unsigned currently limited to 9223372036854775807, we'll expand it to 18446744073709551615 in the future.

On StoneDB, the precision for DECIMAL numbers cannot be higher than 18. For example, if you specify decimal(19) in your code, an error will be reported. DECIMAL(6, 2) indicates that up to 4 places are supported at the left of the decimal and up to 2 at the right, and thus the value range is [-9999.99, 9999.99].

String data types

The storage required for a string varies according to the character set in use. The length range also differs. The following table describes the length range of each string data type when character set latin1 is in use.

Data typeSize
CHAR(M)[0, 255]
VARCHAR(M)[0, 65535]
TINYTEXT[0, 255]
TEXT[0, 65535]
MEDIUMTEXT[0, 16777215]
LONGTEXT[0, 4294967295]

Date and time data types

The following table describes the value range of each date and time data type.

Data typeFormatMin. valueMax. value
YEARYYYY19012155
TIMEHH:MM:SS-838:59:59838:59:59
DATEYYYY-MM-DD0000-00-009999-12-31
DATETIMEYYYY-MM-DD HH:MM:SS0000-00-00 00:00:009999-12-31 23:59:59
TIMESTAMPYYYY-MM-DD HH:MM:SS1970-01-01 08:00:012038-01-19 11:14:07