Skip to main content
RisingWave supports a dedicated vector(n) data type to represent fixed-length numerical vectors, similar to the pgvector extension in PostgreSQL. Vectors are commonly used to store embeddings and other high-dimensional feature data.

Define a vector type

n is a positive integer specifying the number of dimensions (elements) in the vector. All elements are stored as real (float32) values, and they must be finite numbers,NULL, NaN, inf, and -inf are not allowed. Vectors are represented in SQL using a bracketed, comma-separated list format such as [1.0, 2.0, 3.0].

Examples

Type casts

Vectors can be converted between other types using casts:

Distance functions

RisingWave provides built-in operators and functions for measuring distance and similarity between vectors.

Other vector operators

In addition to distance functions, RisingWave supports element-wise operations and vector transformations: