Skip to main content
This feature is in and subject to change. To share feedback and/or issues, contact Support.
The VECTOR data type stores fixed-length arrays of floating-point numbers, which represent data points in multi-dimensional space. Vector search is often used in AI applications such as Large Language Models (LLMs) that rely on vector representations. For details on valid VECTOR comparison operators, refer to Syntax. For the list of supported VECTOR functions, refer to .
VECTOR functionality is compatible with the pgvector extension for PostgreSQL.

Syntax

A VECTOR value is expressed as an of . The array size corresponds to the number of VECTOR dimensions. For example, the following VECTOR has 3 dimensions:
You can specify the dimensions when defining a VECTOR column. This will enforce the number of dimensions in the column values. For example:
The following VECTOR comparison operators are valid:
  • = (equals). Compare vectors for equality in filtering and conditional queries.
  • <> (not equal to). Compare vectors for inequality in filtering and conditional queries.
  • <-> (L2 distance). Calculate the Euclidean distance between two vectors, as used in nearest neighbor search and clustering algorithms.
  • <#> (negative inner product). Calculate the inner product of two vectors, as used in similarity searches where the inner product can represent the similarity score.
  • <=> (cosine distance). Calculate the cosine distance between vectors, such as in text and image similarity measures where the orientation of vectors is more important than their magnitude.

Size

The size of a VECTOR value is variable, but it’s recommended to keep values under 1 MB to ensure performance. Above that threshold, and other considerations may cause significant performance degradation.

Functions

For the list of supported VECTOR functions, refer to .

Example

Create a table with a VECTOR column, specifying 3 dimensions:
Insert some sample data into the table:
Large batch inserts of types can cause performance degradation. When inserting vectors, batching should be avoided. For an example, refer to . Use the <-> operator to sort values with the electronics category by their similarity to [1.0, 0.0, 0.0], based on geographic distance.
You can use a to make searches on large numbers of high-dimensional VECTOR rows more efficient.

See also