Vector Types
In the previous sections Indexing and Search, we encountered the vector type. This section will explore additional vector types and their applications in the realm of vector search.
- Half-Precision Vector
- 8-Bit Integer Vector since v0.3.0
- Sparse Vector since v0.3.0
- Binary Vector since v0.3.0
Low-precision Indexing
since v0.3.0To improve the speed of queries on the vector column, consider creating a low-precision index using vecf16, veci8, or bvector types instead of a vector type.
Shortening Embedding
since v0.3.0Certain embedding models like OpenAI text-embedding-3-small support shortening embeddings, which involves removing some numbers from the end of the sequence without losing the embedding’s concept-representing properties.
In some cases, it may be necessary to change the embedding dimension after generation. The pgvecto.rs offers an approach to query by shortened embeddings.
Shortened embeddings are supported by all data types in pgvecto.rs since version v0.3.0.
Casts
This diagram shows the conversion between different data types, where the types connected by arrows can be cast to each other:
Among them, ARRAY is a native type of postgreSQL, others are types defined by pgvecto.rs.
Here are some examples of vector type casting:
Stored as a half-precision number format, vecf16 takes advantage of the 16-bit float, which uses half the memory and bandwidth compared to vector.
Int8 is a data type used to represent signed integers. It stands for “integer 8-bit” and typically uses 8 bits of memory to store a value. This allows it to rep
Unlike dense vectors, sparse vectors are very high-dimensional but contain few non-zero values.
The bvector type is a binary vector type in pgvecto.rs. It represents a binary vector, which is a vector where each component can take on two possible values, t