Skip to content

Schema

Here is the schema provided by pgvecto.rs.

List of data types

NameDescription
vectorvector, scalar type of which is binary32 defined in IEEE 754-2008
vecf16vector, scalar type of which is binary16 defined in IEEE 754-2008
veci8vector, scalar type of which is 8-bit Integer
svectorsparse vector, scalar type of which is binary32 defined in IEEE 754-2008
bvectorbinary vector, a fixed-length bit string
vector_index_stata composite type representing vector index statistics

List of operators

NameLeft arg typeRight arg typeResult typeDescription
+vectorvectorvectorelement-wise arithmetic
+vecf16vecf16vecf16element-wise arithmetic
+veci8veci8veci8element-wise arithmetic
+svectorsvectorsvectorelement-wise arithmetic
-vectorvectorvectorelement-wise arithmetic
-vecf16vecf16vecf16element-wise arithmetic
-veci8veci8veci8element-wise arithmetic
-svectorsvectorsvectorelement-wise arithmetic
&bvectorbvectorbvectorelement-wise logical AND
|bvectorbvectorbvectorelement-wise logical OR
^bvectorbvectorbvectorelement-wise logical XOR
=vectorvectorbooleandictionary order comparison
=vecf16vecf16booleandictionary order comparison
=veci8veci8booleandictionary order comparison
=svectorsvectorbooleandictionary order comparison
=bvectorbvectorbooleandictionary order comparison
<>vectorvectorbooleandictionary order comparison
<>vecf16vecf16booleandictionary order comparison
<>veci8veci8booleandictionary order comparison
<>svectorsvectorbooleandictionary order comparison
<>bvectorbvectorbooleandictionary order comparison
<vectorvectorbooleandictionary order comparison
<vecf16vecf16booleandictionary order comparison
<veci8veci8booleandictionary order comparison
<svectorsvectorbooleandictionary order comparison
<bvectorbvectorbooleandictionary order comparison
>vectorvectorbooleandictionary order comparison
>vecf16vecf16booleandictionary order comparison
>veci8veci8booleandictionary order comparison
>svectorsvectorbooleandictionary order comparison
>bvectorbvectorbooleandictionary order comparison
<=vectorvectorbooleandictionary order comparison
<=vecf16vecf16booleandictionary order comparison
<=veci8veci8booleandictionary order comparison
<=svectorsvectorbooleandictionary order comparison
<=bvectorbvectorbooleandictionary order comparison
>=vectorvectorbooleandictionary order comparison
>=vecf16vecf16booleandictionary order comparison
>=veci8veci8booleandictionary order comparison
>=svectorsvectorbooleandictionary order comparison
>=bvectorbvectorbooleandictionary order comparison
<->vectorvectorrealsquared Euclidean distance
<->vecf16vecf16realsquared Euclidean distance
<->veci8veci8realsquared Euclidean distance
<->svectorsvectorrealsquared Euclidean distance
<->bvectorbvectorrealsquared Euclidean distance
<#>vectorvectorrealnegative dot product
<#>vecf16vecf16realnegative dot product
<#>veci8veci8realnegative dot product
<#>svectorsvectorrealnegative dot product
<#>bvectorbvectorrealnegative dot product
<=>vectorvectorrealcosine distance
<=>vecf16vecf16realcosine distance
<=>veci8veci8realcosine distance
<=>svectorsvectorrealcosine distance
<=>bvectorbvectorrealcosine distance
<~>bvectorbvectorrealjaccard distance

List of functions

NameArgument typeResult typeDescription
pgvectors_upgradevoidAdministration function for upgrading pgvecto.rs.
to_svectordims integer, index integer[], value real[]svectorConstruct a sparse vector from two arrays of indexes and values
binarizevector vectorbvectorBinarize a vector. All positive elements are set to 1, otherwise 0.
text2vec_openaiinput text, model textvectorEmbedding function for OpenAI embeddings API.
text2vec_openai_v3input textvectorEmbedding function for OpenAI embeddings API. The model is set to text-embedding-3-small.
vector_dimsvectorintegerGet the dimension of given vector.
vector_normvectorrealCalculates the Euclidean norm of a given vector.
avgvector[]vectorAggregate Function. Calculates the average of given vectors.
sumvector[]vectorAggregate Function. Calculates the sum of given vectors.

List of casts

Source typeTarget typeImplicit?
real[]vectoryes
vectorreal[]yes
vectorvecf16no
vecf16vectorno
vectorveci8no
veci8vectorno
vectorsvectorno
svectorvectorno
vectorbvectorno
bvectorvectorno

List of access methods

NameTypeDescription
vectorsIndexpgvecto.rs vector index

List of operator families

AMOperator familyApplicable types
vectorsvector_cos_opsvector
vectorsvector_dot_opsvector
vectorsvector_l2_opsvector
vectorsvecf16_cos_opsvecf16
vectorsvecf16_dot_opsvecf16
vectorsvecf16_l2_opsvecf16
vectorsveci8_cos_opsveci8
vectorsveci8_dot_opsveci8
vectorsveci8_l2_opsveci8
vectorssvector_cos_opssvector
vectorssvector_dot_opssvector
vectorssvector_l2_opssvector
vectorsbvector_cos_opsbvector
vectorsbvector_dot_opsbvector
vectorsbvector_l2_opsbvector
vectorsbvector_jaccard_opsbvector

List of operator classes

AMInput typeOperator classDefault?Description
vectorsvectorvector_l2_opsnosquared Euclidean distance
vectorsvectorvector_dot_opsnonegative dot product
vectorsvectorvector_cos_opsnocosine distance
vectorsvecf16vecf16_l2_opsnosquared Euclidean distance
vectorsvecf16vecf16_dot_opsnonegative dot product
vectorsvecf16vecf16_cos_opsnocosine distance
vectorsveci8veci8_l2_opsnosquared Euclidean distance
vectorsveci8veci8_dot_opsnonegative dot product
vectorsveci8veci8_cos_opsnocosine distance
vectorssvectorsvector_l2_opsnosquared Euclidean distance
vectorssvectorsvector_dot_opsnonegative dot product
vectorssvectorsvector_cos_opsnocosine distance
vectorsbvectorbvector_l2_opsnosquared Euclidean distance
vectorsbvectorbvector_dot_opsnonegative dot product
vectorsbvectorbvector_cos_opsnocosine distance
vectorsbvectorbvector_jaccard_opsnojaccard distance

List of views

NameDescription
pg_vector_index_statA view provided for vector index statistics