pgvector provides four main representations: vector for single-precision dense values, halfvec for smaller half-precision dense values, bit for binary signatures, and sparsevec for mostly zero coordinates. Type choice affects dimensions, storage, supported metrics, operator classes, accuracy, and indexing. Choose through workload measurement, not novelty.
As verified against pgvector v0.8.6 documentation, HNSW supports vector up to 2,000 dimensions, halfvec up to 4,000, bit up to 64,000 bits, and sparsevec up to 1,000 non-zero elements. IVFFlat supports vector up to 2,000, halfvec up to 4,000, and bit up to 64,000. Confirm limits for your installed version.
Sparse syntax records non-zero index:value pairs and total dimensions. Inspect canonical output before building a loader.
You may store full vectors and index an expression cast:
The query must use the same expression shape to use the index, then can rerank candidates by the original vector.
Use pg_column_size on representative values, then build a small exact-retrieval baseline. Compare top-k overlap and recall after half precision or binary quantization. Use EXPLAIN to confirm expression-index matching.
Given dimensions, row count, metric, recall target, write rate, latency target, and memory budget [values], compare vector, halfvec, bit, and sparsevec. Eliminate incompatible options, propose an exact baseline and experiment, and generate matching index/query expressions. Cite the installed-version limits I provide.
Verification contract: Accept a new type only after measuring storage, build time, write throughput, latency, and per-slice retrieval quality against the original vectors.