OceanBase Database provides vector data types to support AI vector search applications. With vector data types, you can store and query a float array, for example, [0.1, 0.3, -0.9, ...]. Before you use vector data types, note the following items:
Only single-precision floating-point numbers are supported.
Vector data cannot contain non-numerical values (NaN) or infinity (Inf). Otherwise, a runtime error will be thrown.
You must specify the vector dimension when you create a vector column, for example,
VECTOR(3).You can create vector indexes. For more information, see Create a vector index.
In OceanBase Database, vector data is stored in arrays.
Syntax
A vector value can contain any number of floating-point numbers. The syntax is as follows:
'[<float>, <float>, ...]'
Here are some examples of creating vector columns and indexes:
CREATE TABLE t1(
c1 INT,
c2 VECTOR(3),
PRIMARY KEY(c1),
VECTOR INDEX idx1(c2) WITH (distance=L2, type=hnsw)
);