Extended Protocol Packet Metadata
Warning
SingleStore 9.0 gives you the opportunity to preview, evaluate, and provide feedback on new and upcoming features prior to their general availability. In the interim, SingleStore 8.9 is recommended for production workloads, which can later be upgraded to SingleStore 9.0.
On this page
SingleStore uses the same format of column definition packet when communicating between the client and the server as the MySQL protocol.BSON
and VECTOR
.
By default, SingleStore does not send extended metadata in the protocol packet for backward compatibility.BSON
and VECTOR
type columns are sent to the clients as LONGBLOB
and VARCHAR
, respectively.
Extended protocol packet metadata is supported in SingleStore version 8.
Note: The MariaDB C library does not support extended metadata format.
Enable Extended Metadata
To enable sending extended metadata in the protocol packet for BSON
and VECTOR
data types:
SET SESSION enable_extended_types_metadata = TRUE;
enable_
is a session variable that can be set globally.
Extended Metadata Format
The packet metadata for extended types has the following structure:
Type |
Name |
Description |
---|---|---|
|
catalog |
Catalog name. |
|
database |
Database name |
|
table |
Virtual table name |
|
org_ |
Physical table name |
|
name |
Virtual column name |
|
org_ |
Physical column name |
|
|
Length of the fixed length fields. |
|
character_ |
The column character set. |
|
column_ |
Maximum length of the field in bytes. |
|
type |
Column type. |
|
flags |
|
|
decimals |
Number of decimal places. |
|
unused |
Two unused zero-bytes. |
|
type code of extended datatype |
Type code of the extended type. |
where, lenenc
represents a length-encoded string.
For VECTOR
types, the protocol packet metadata contains the following additional bytes:
Type |
Name |
Description |
---|---|---|
|
number of vector elements |
Dimension of the |
|
type of vector elements |
The type of elements in the vector data. |
For VECTOR
Types
For VECTOR
types, the protocol packet metadata contains the following 6 bytes in addition to the default 12 bytes:
-
1 byte: Specifies the type code.
This value is 2
forVECTOR
data types. -
4 bytes: Specifies the dimension (number of elements) of the vector data.
-
1 byte: Specifies the type of elements in the vector data.
It can have the following values based on the type of the vector elements: Value
Vector Element Type
1
F32
2
F64
3
I8
4
I16
5
I32
6
I64
For example, the protocol packet metadata for a VECTOR(23)
type column (starting from the "Length of the fixed length field" byte) is:
Extended Types Disabled |
Extended Types Enabled |
---|---|
0c 3f 00 ff ff ff ff fd 90 00 00 00 00 |
12 3f 00 ff ff ff ff fd 90 00 00 00 00 02 17 00 00 00 01 |
where the extended bytes represent the following:
-
02
: Type code forVECTOR
type. -
17 00 00 00
: Dimension (length) of the vector data, i.e. , 23
. -
01
: Vector element type, i.e. , F32
.
For BSON
Types
For BSON
types, the protocol packet metadata contains 1 byte in addition to the default 12 bytes.1
for BSON
types.
Last modified: February 25, 2025