Skip to main content
Version: V1.0.0

Overview of vector data types

seekdb provides vector data types to support AI vector search applications. By using vector data types, you can store and query an array of floating-point numbers, such as [0.1, 0.3, -0.9, ...]. Before using vector data, you need to be aware of the following:

  • Both dense and sparse vector data are supported, and all data elements must be single-precision floating-point numbers.

  • Element values in vector data cannot be NaN (not a number) or Inf (infinity); otherwise, a runtime error will be thrown.

  • You must specify the vector dimension when creating a vector column, for example, VECTOR(3).

  • Creating dense/sparse vector indexes is supported. For details, see vector index.

  • Vector data in seekdb is stored in array form.

  • Both dense and sparse vectors support hybrid search.

Syntax

A dense vector value can contain any number of floating-point numbers up to 16,000. The syntax is as follows:

-- Dense vector
'[<float>, <float>, ...]'

A sparse vector is based on the MAP data type and contains unordered key-value pairs. The syntax is as follows:

-- Sparse vector
'{<uint:float>, <uint:float>...}'

Examples of creating vector columns and indexes are as follows:

-- Create a dense vector column and index
CREATE TABLE t1(
c1 INT,
c2 VECTOR(3),
PRIMARY KEY(c1),
VECTOR INDEX idx1(c2) WITH (distance=L2, type=hnsw)
);
-- Create a sparse vector column
CREATE TABLE t2 (
c1 INT,
c2 SPARSEVECTOR
);

References