Ditching pgvector: Migrating 1.7TB of Data to a Custom Rust Search Engine

After 1.7 TB of data overwhelmed pgvector, the team built a custom Rust search engine—a migration sample and selection lessons.
The article describes a case where a developer migrated 1.7 TB of vector data from pgvector to a custom Rust search engine. pgvector relies on the PostgreSQL ecosystem and suits small to medium-scale vector retrieval, but when data volume breaks through the TB level, query latency, index build time, and resource consumption become bottlenecks. A custom Rust engine allows deep customization of index structures, compression strategies, and concurrency models for one's own data distribution and query patterns, at the cost of reimplementing vector similarity computation, inverted indexes, persistent storage, and ensuring consistency. The author reminds that most teams should first try parameter tuning, partitioning, or read-write separation; only when the business truly needs extreme performance and the team has system development capabilities is in-house development worth considering; tool selection should evolve with data scale.
Migration Background
When data grew to 1.7 TB, the original vector search solution based on pgvector began to show its limits. A developer shared on Hacker News their experience migrating all their data to a custom Rust search engine, drawing attention. Although the discussion wasn't very heated (only 11 points, 2 comments), the case itself offers reference value for teams struggling with vector database selection.
pgvector's advantage lies in its seamless integration with the PostgreSQL ecosystem, making it suitable for small to medium-scale vector retrieval. But when data volume breaks through the TB level, query latency, index build time, and resource consumption all become problems. The motivation for migration usually comes from performance or cost pressure, not purely technical preference.

pgvector is an open-source extension for PostgreSQL that adds a vector data type and corresponding distance operators (such as L2, inner product, cosine distance) within the database, and supports two approximate nearest neighbor (ANN) indexes: IVFFlat and HNSW. Its core selling point is putting vector retrieval and business tables in the same transaction, the same backup and permission system, eliminating the operational overhead of maintaining a separate vector database. However, pgvector's indexes are built on top of PostgreSQL's storage and concurrency model: the HNSW index has a large in-memory graph structure, long build times, and early versions had limited support for parallel builds and incremental updates. When the number of vector rows reaches hundreds of millions and the total volume enters the TB range, index building can take hours or longer, and memory usage and page cache contention during queries can significantly raise P99 latency—this is the technical root of the bottleneck described in the article.
Why Choose a Custom Rust Engine
Rust's memory safety and zero-cost abstractions in systems programming make it a popular choice for building high-performance search components. A custom engine means the team can deeply customize for their own data distribution and query patterns—for example, optimizing index structures, compression strategies, and concurrency models—without being constrained by the abstraction layers of a general-purpose database.
However, building in-house also means bearing maintenance costs. Migrating from pgvector to a custom system requires reimplementing modules such as vector similarity computation, inverted indexes, and persistent storage, while ensuring data consistency. The developer didn't disclose specific architecture details in the sharing, but given the scale, this is a decision requiring serious engineering investment.
Zero-cost abstraction is one of Rust's core design philosophies: high-level abstractions like iterators, generics, and traits are monomorphized or inlined at compile time, with runtime overhead roughly equivalent to hand-written low-level code. For latency-sensitive systems like search engines, this means complex index and query logic can be organized with safe, readable code without falling back to large amounts of unsafe code for performance. Combined with ownership and borrow checking, Rust can eliminate data races at compile time, making it less prone to memory safety issues when building indexes in parallel across threads and processing queries concurrently. This also explains why a batch of search and vector retrieval projects like Tantivy, Qdrant, and Meilisearch have chosen Rust in recent years.
The Cost of Migration and Lessons Learned
Migrating 1.7 TB of data is no small project, involving data export, format conversion, index rebuilding, and online cutover. For most teams, before pgvector hits its limits, a more pragmatic approach might be to first try parameter tuning, partitioning, or read-write separation. Only when the business truly needs extreme retrieval performance and the team has system development capabilities is a custom engine worth considering.
The value of this case lies in providing a real technical decision sample: tool selection should evolve with data scale, and there's no one-size-fits-all solution. pgvector remains a reasonable starting point for many scenarios, but knowing where its boundaries are is equally important.
Inverted index is a fundamental data structure of search engines: it uses terms as keys, recording which documents and positions each term appears in, thereby reducing queries like "documents containing a certain word" from full table scans to a single lookup. Vector retrieval solves the problem of semantic similarity, while inverted indexes solve the problem of exact keyword matching and filtering—the two usually need to be used together in hybrid search. When building a custom engine, the team must implement both sets of indexes and their joint ranking logic, and also handle details like persistence, segment merging, deletion markers, and crash recovery—this workload is often underestimated and is the main source of maintenance cost for the in-house route.
One-line Summary
After 1.7 TB of data overwhelmed pgvector, the team built a custom Rust search engine—a migration sample and selection lessons.
Paragraph Summary
The article describes a case where a developer migrated 1.7 TB of vector data from pgvector to a custom Rust search engine. pgvector relies on the PostgreSQL ecosystem and is suitable for small to medium-scale vector retrieval, but when data volume breaks through the TB level, query latency, index build time, and resource consumption all become bottlenecks. The value of a custom Rust engine lies in deep customization of index structures, compression strategies, and concurrency models for one's own data distribution and query patterns, but the cost is reimplementing vector similarity computation, inverted indexes, persistent storage, and ensuring consistency. The author reminds that most teams should first try parameter tuning, partitioning, or read-write separation before migrating; only when the business truly needs extreme performance and the team has system development capabilities is in-house development worth considering; tool selection should evolve with data scale.
Related articles

Small-Model Multi-Task Post-Training: SFT Cold Start and RL Fine-Tuning for Recruiting Match
A small-model multi-task post-training practice based on Qwen3-4B: SFT cold start and GSPO reinforcement learning complete resume screening and ad-invitation ranking without CoT reasoning, significantly improving exact-match rates on structured tasks, with online rules for opening LLM reranking by pCVR range and job family.

Pessimistic Process Supervision: A New Method for Error Tracing in Medical Reasoning
Early errors in medical reasoning propagate to later steps. This article introduces a pessimistic process reward model (PRM) that distinguishes original from inherited errors and predicts error sources, enabling correction at the root to improve answer accuracy.

Optio-Audio-Jev: A Unified Audio Decision Interface That Breaks the Option Limit
Optio-Audio-Jev proposes a unified audio decision interface that replaces fixed output heads with [OPT] token matching, breaking the option limit. Trained on only 13 options, it still maintains 86-90% accuracy on 50-option ESC-50 questions, far exceeding the Jev head's 22-24%, with code, models, and server open-sourced.