Extended Protocol Packet Metadata

SingleStore uses the same format of column definition packet when communicating between the client and the server as the MySQL protocol. By default, packet metadata sent to the client consists of 12 bytes, which does not allow distinguishing non-MySQL protocol-compatible data types. Extending the packet metadata size allows the client to distinguish between data types that are not compatible with MySQL, such as BSON and VECTOR. Refer to enum_field_types Reference for a list of MySQL supported data types.

By default, SingleStore does not send extended metadata in the protocol packet for backward compatibility. When extended metadata in the protocol packet is disabled (default behavior), BSON and VECTOR type columns are sent to the clients as LONGBLOB and VARCHAR, respectively. Refer to Data Types for more information on the respective data types.

Extended protocol packet metadata is supported in SingleStore version 8.5.28 and later.

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_extended_types_metadata is a session variable that can be set globally. SingleStore recommends configuring this engine variable for each session.

Extended Metadata Format

The packet metadata for extended types has the following structure:

Type

Name

Description

string<lenenc>

catalog

Catalog name. Currently, this value is always "def".

string<lenenc>

database

Database name

string<lenenc>

table

Virtual table name

string<lenenc>

org_table

Physical table name

string<lenenc>

name

Virtual column name

string<lenenc>

org_name

Physical column name

int<lenenc>

Length of the fixed length fields. This value is greater than or equal to 12 (0x0C) bytes.

int<2>

character_set

The column character set.

int<4>

column_length

Maximum length of the field in bytes.

int<1>

type

Column type.

int<2>

flags

Column definition flags.

int<1>

decimals

Number of decimal places.

int<2>

unused

Two unused zero-bytes.

int<1>

type code of extended datatype

Type code of the extended type. This value is 2 for VECTOR data types and 1 for BSON types.

where, lenenc represents a length-encoded string.

For VECTOR types, the protocol packet metadata contains the following additional bytes:

Type

Name

Description

int<4>

number of vector elements

Dimension of the VECTOR type.

int<1>

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. 1 byte: Specifies the type code. This value is 2 for VECTOR data types.

  2. 4 bytes: Specifies the dimension (number of elements) of the vector data.

  3. 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 for VECTOR 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. This additional byte specifies the type code, which is 1 for BSON types.

Last modified: February 25, 2025

Was this article helpful?

Verification instructions

Note: You must install cosign to verify the authenticity of the SingleStore file.

Use the following steps to verify the authenticity of singlestoredb-server, singlestoredb-toolbox, singlestoredb-studio, and singlestore-client SingleStore files that have been downloaded.

You may perform the following steps on any computer that can run cosign, such as the main deployment host of the cluster.

  1. (Optional) Run the following command to view the associated signature files.

    curl undefined
  2. Download the signature file from the SingleStore release server.

    • Option 1: Click the Download Signature button next to the SingleStore file.

    • Option 2: Copy and paste the following URL into the address bar of your browser and save the signature file.

    • Option 3: Run the following command to download the signature file.

      curl -O undefined
  3. After the signature file has been downloaded, run the following command to verify the authenticity of the SingleStore file.

    echo -n undefined |
    cosign verify-blob --certificate-oidc-issuer https://oidc.eks.us-east-1.amazonaws.com/id/CCDCDBA1379A5596AB5B2E46DCA385BC \
    --certificate-identity https://kubernetes.io/namespaces/freya-production/serviceaccounts/job-worker \
    --bundle undefined \
    --new-bundle-format -
    Verified OK