BLOB Types
The BLOB
type is a form of VARBINARY
string type.BLOB
type has no connection to columnstore segments, also known as blobs.
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.
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.
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 |
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: August 29, 2024