Important
Self-managed SingleStore will soon transition from version 9.1 RC to version 10. This new semantic versioning scheme will provide SingleStore with finer control over engine and feature releases that were not possible with the current versioning scheme.
In the interim, SingleStore 9.1 RC can be used to preview, evaluate, and provide feedback on the new and upcoming features in SingleStore 10 prior to its general availability. Ahead of this transition, SingleStore 9.0 is recommended for production workloads, which can later be upgraded to SingleStore 10.
Binary String Types
On this page
This page describes binary string types, including BINARY, VARBINARY, and BLOB types.
BINARY
BINARY is a fixed-length string type in SingleStore.BINARY requires LENGTH bytes of memory.binary(0) not null allocates 1 byte.
|
Data Type |
Size |
Size (Not Null) |
|---|---|---|
|
BINARY(LENGTH) |
LENGTH + 1 bytes |
LENGTH bytes |
CHAR is another fixed-length string type in SingleStore.
VARBINARY
VARBINARY is a variable-length string type in SingleStore.
VARBINARY fields store data verbatim, regardless of whether they are valid Unicode strings.VARBINARY uses the exact binary representation.
The total space consumed by a particular string value is:
-
The byte length of the string.
-
An 8-byte overhead for the pointer.
-
A 4-byte overhead for storing the length.
There is no 4-byte overhead if the field is nullable.
Note
One exception is values less than 7 bytes long.
To reduce memory fragmentation, memory for variable-sized data is allocated from a fixed list in multiples of eight (16, 32, 40, etc.
|
Data Type |
Max Length |
|---|---|
|
VARBINARY |
65533 bytes |
VARCHAR and LONGTEXT are other variable-length string types in SingleStore.
BLOB Types
The BLOB type is a form of VARBINARY string type.BLOB type has no connection to columnstore segments, also known as blobs.
While BLOB data types operate the same for most English-language alphanumeric strings, there are several important differences in their behavior.BLOB fields store data verbatim, regardless of whether they are valid Unicode strings.BLOB uses the exact binary representation.
Note
There are several variants of the BLOB type, which are listed below.
|
Name |
Max Length |
Description |
|---|---|---|
|
LONGBLOB |
4GB |
VARBINARY - While the DDL will allow you to specify a size of up to 4GB, there is an internal limit applied when assigning a value to a LONGBLOB field that caps the maximum size of a single value to |
|
MEDIUMBLOB |
16 MB |
VARBINARY |
|
BLOB |
65,535 bytes |
VARBINARY |
|
TINYBLOB |
225 bytes |
VARBINARY |
Unlike variable-length TEXT types, comparison operators treat trailing spaces differently when used with a variable-length BLOB type.BLOB type uses the binary character set while TEXT uses UTF8 by default, but can be changed.
Last modified: