Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

pgvector is a PostgreSQL extension that adds vector data types and similarity-search operators to a database you may already run. It can keep embeddings beside application records and query them with SQL, so a separate vector database is not automatically required. Whether that setup fits depends on your workload: measure recall, latency, memory use, filtering behavior, index-build time, and operational needs before choosing.

What is pgvector?

pgvector extends PostgreSQL; it is not a standalone database. It adds vector storage and distance operations, allowing embeddings to live alongside ordinary relational rows. The project documents PostgreSQL capabilities such as transactions, joins, replication, and point-in-time recovery as part of this integrated approach. See the pgvector project documentation.

The extension supports vector, halfvec, bit, and sparsevec representations, with L2, inner-product, cosine, L1, Hamming, and Jaccard distance operators. Choose an index operator class that matches the distance function used in the query; otherwise the index may not support that search as intended.

Documented indexing dimension limits

Representation Documented index limit
vector 2,000 dimensions
halfvec 4,000 dimensions
bit 64,000 dimensions
sparsevec 1,000 non-zero elements

These are documented indexing limits, not recommendations for a particular workload or guarantees about performance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How does pgvector search work?

Exact nearest-neighbor search is the default: PostgreSQL evaluates the requested distance against the available rows rather than relying on an approximate vector index. That makes exact search a valuable quality baseline. Approximate indexes can speed up retrieval, but may return a different set of neighbors and therefore trade some recall for speed.

Should you use HNSW or IVFFlat?

pgvector documents two approximate index types with different operating costs. The tradeoffs below are general project guidance, not benchmark results for your data.

Decision factor HNSW IVFFlat
Speed/recall tradeoff Generally stronger Generally weaker
Build time Slower Faster
Memory use Higher Lower
When index can be created Can create on an empty table Build after loading data
Main tuning settings m, ef_construction, hnsw.ef_search lists, ivfflat.probes

Compare each index with exact results and tune it against representative queries. Recall and latency can vary with embedding distribution, query mix, filtering, concurrency, and available memory; there is no universal index setting or vector-count cutoff established by the project.

Why can filters return fewer rows with an approximate index?

With approximate indexes, filtering occurs after the approximate index scan. The scan may therefore produce too few candidates that satisfy a SQL condition, even when more qualifying rows exist elsewhere in the table. The pgvector README illustrates this with a condition matching 10% of rows and default HNSW ef_search of 40: about four matching rows on average. That is an explanatory example, not a promise for every data distribution.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Mitigations for filtered searches

  • Iterative scans: pgvector documents these beginning with version 0.8.0; they can continue scanning to find more qualifying rows.
  • Partial indexes: consider them when a filter has only a few distinct values and an index per relevant subset is practical.
  • Partitioning: consider it when there are many distinct filter values and queries can target the appropriate partitions.

For multitenant applications, a shared approximate index can let one tenant’s vectors affect another tenant’s recall and speed. The project suggests list partitioning or separate tables when tenant isolation is important. These choices add operational complexity, so test them with the actual tenant and filter distribution.

Can pgvector support hybrid search?

Yes. PostgreSQL full-text search can be combined with pgvector similarity search to retrieve candidates using both lexical matching and semantic similarity. The project describes reciprocal rank fusion and cross-encoders as approaches for combining result lists. These are ranking techniques to implement in an application or query workflow, not one-click ranking strategies built into pgvector.

When does using PostgreSQL make sense?

Keeping vectors, relational data, joins, transactions, and existing database operations together can be worthwhile when that integration is more valuable than the performance or operational advantages of adding a specialized vector system. That is a workload decision, not a claim that PostgreSQL can handle every scale or query pattern.

  • Benchmark representative embeddings and the real query and filter distribution.
  • Compare approximate results with exact search to quantify recall changes.
  • Measure query latency, concurrency, memory use, and index-build time.
  • Account for how filtering, tenant isolation, backups, and scaling affect operations.

The reviewed project and vendor material does not establish a general vector-count threshold for moving to a specialized database, nor does it provide an independent cross-database benchmark. AWS says pgvector is supported by Aurora PostgreSQL and documents an “up to 9x” vector-search queries-per-second claim for workloads exceeding available instance memory with Aurora optimized reads. That is an AWS claim about its Aurora configuration, not a general pgvector benchmark.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What do you need to run pgvector?

The project documentation lists PostgreSQL 13 or later as supported. Installation depends on how PostgreSQL is deployed; follow the instructions for the relevant operating system or managed service rather than assuming one command works everywhere.

Check release artifacts before pinning a version in deployment instructions. The pgvector GitHub tag page lists v0.8.6 dated 2026-07-29 as its newest visible tag, and the companion documentation also identifies v0.8.6, while the repository README installation command refers to v0.8.7. Those references conflict, so confirm the current release artifact before copying a version-specific command.

Security deserves a separate check: a PostgreSQL project notice dated 2026-02-26 says pgvector 0.8.2 fixes CVE-2026-3172, a buffer overflow in parallel HNSW index builds that could leak data from other relations or crash the server. The notice encouraged upgrading; it does not establish that later versions have no subsequent issues. Review current advisories and release notes for the version you plan to deploy.

Sources and further reading

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.