Follow us
Breaking
Software

Migrating from specialized vector stores to Rust-powered Postgres

Teams like Notion reduce search costs by 60% by migrating from Pinecone to Postgres. The Rust-based pgvecto.rs extension offers 20x faster HNSW performance than pgvector and solves recall issues through its integrated VBASE filtering method.

Share

Why teams replace pgvector and Pinecone

The decision to migrate from a specialized database like Pinecone to a Postgres extension depends on whether your team prefers paying for managed simplicity or keeping control over infrastructure and costs. Companies like Notion cut search costs by 60% by migrating from Pinecone Serverless. Specialized vector databases create high bills, with some production environments seeing costs jump from $50 to $2,847 per month for the same workload. These costs increase because the read-unit model charges more when users apply metadata filtering. Teams move to PostgreSQL to keep embeddings next to relational data and avoid managing a separate system. While pgvector provides a way to add vectors to Postgres, its metadata filtering happens as a post-filter on the candidate set. This behavior causes recall issues when users apply selective filters on large collections. For comparison, Qdrant runs filters inside the HNSW graph traversal to keep queries snappy. Pinecone serverless pins recall at 90% and makes writes eventually consistent. For organizations hitting 100M to 1B vectors, Milvus remains a candidate due to its distributed architecture, but most teams find specialized databases unnecessary.

The performance of pgvecto.rs

pgvecto.rs replaces the C-based pgvector extension with a Rust-based implementation using the pgrx framework. The HNSW algorithm in pgvecto.rs runs 20x faster than pgvector at 90% recall. It also introduces the VBASE method to combine vector search with relational queries like joins and filters in one operation. This prevents the recall issues found in pgvector, where filters act as post-filters on the candidate set. The extension supports up to 65535 dimensions and provides data types like FP16, INT8, and binary vectors to lower memory usage. Replacing the standard vector type with vecf16type improves performance. It manages index storage and memory separately from the native PostgreSQL storage engine. The software uses runtime SIMD instructions to maximize performance based on the specific hardware. Rust provides strict compile-time checks that guarantee memory safety. This makes the extension more approachable for developers to use compared to C codebases. The extensible architecture uses traits to define behaviors like building, saving, loading, and querying. This allows contributors to add new index types like RHNSW or NGT easily. If you are already running Postgres, you should test this extension to see how much memory you can save. Will the community move entirely to VectorChord in the coming months? Maintainers now suggest migrating to VectorChord for improved stability and performance.

Technical specifications and limits

Feature pgvecto.rs pgvector
Max Dimensions 65535 2000
Extra Data Types FP16, INT8, Binary None
Filtering VBASE (integrated) Post-filter (after search)
Language Rust C

pgvecto.rs allows for distance calculations using three operators: squared Euclidean distance, negative dot product, and cosine distance. While pgvector supports 2000 dimensions, pgvecto.rs supports up to 65535 dimensions. The VBASE method enables Single-Vector TopK, Filter, and Join operations in a single query. Users start by using the Docker image to deploy the extension quickly. You can connect to the database using the psql command line tool. The extension provides Write-Ahead Logging support for data, while index support remains a work in progress. You can create a table with the vector(n) data type, where n is the number of dimensions. This type is only valid if the number of dimensions is between 1 and 65535. If the values in the column mismatch the dimension denoted by the column, you cannot create an index on it. You can create a vector(3) with 5 dimensions, but you cannot use 0 scalars or more than 65535 scalars in a single vector. Developers implement new index types by creating a struct and implementing the required traits.

Share

Technewsdaily

Senior tech writer covering AI, gadgets and cybersecurity. Breaking down the news that matters, every day.