Home / Blog / A team moved 1.7 TB off pgvector to our own Rust search…
Tech News

A team moved 1.7 TB off pgvector to our own Rust search engine

Circleback replaced 1.7 TB of unindexed pgvector with its Orion Rust search engine, cutting 20-to-40-second queries under 1 second at one-tenth the cost.

By Dillip Chowdary • Dec 03, 2026 • Source: circleback.ai

A team moved 1.7 TB off pgvector to our own Rust search engine
Image: circleback.ai

At a glance

Old setup
1.7 TB unindexed pgvector in Postgres
Search volume
~3.5M in Oct (18x Jan, ~90% agents)
Worst latency
20–40s before, tens of ms in Orion
Chunk retrieval
~700 ms down to under 100 ms
Cost impact
Expected ~10% of prior search cost
Stack
Rust with jemalloc, S3/GCS blob index

Circleback has replaced its 1.7 TB PostgreSQL and pgvector search setup with Orion, a custom search engine rewritten in Rust that cuts slowest customer queries from 20–40 seconds down to tens of milliseconds, according to circleback.ai's report. Built over a weekend with assistance from Claude Opus, Orion indexes both vector embeddings and text inside blob storage while handling embedding generation itself.

This article breaks down why Circleback's Postgres architecture choked under AI agent traffic, why the team passed on Turbopuffer and Elasticsearch, and the specific Rust memory, serialization, and sharding fixes that cut expected search infrastructure costs to roughly one-tenth of prior spending. Backend and AI infrastructure engineers scaling multi-tenant RAG systems can apply these lessons directly.

01Why 1.7 TB in pgvector buckled under agents

Circleback stores meeting transcripts as chunks with vector embeddings inside its primary PostgreSQL database, accumulating 1.7 TB of unindexed vector data. Every search scanned all chunks across every meeting a user could access, reading heavily from disk and evicting working application data from memory.

Search demand compounded the bottleneck: in October, Circleback served roughly 3.5 million searches—18x January's volume—with nearly 9 in 10 queries originating from AI agents via its MCP server, API, and CLI. Meanwhile, Postgres full-text search stemmed stored transcripts (turning "pricing" into "price") without matching stems on queries, dropped CJK characters, and forced three database upscales in 18 months alongside high external embedding bills.

02Evaluating Turbopuffer and Elasticsearch versus Orion

To eliminate the Postgres bottleneck, the engineering team resurrected Orion, an older 2019 search project, and rewrote it completely in Rust with Claude Opus over a single weekend. They evaluated two prominent alternatives before committing to an in-house engine.

SystemStorage & Compute ModelEmbedding GenerationWhy Circleback Decided
Postgres + pgvector1.7 TB unindexed table in primary DBExternal embedding service20–40s worst queries, evicted app cache
TurbopufferBlob-backed vector storeExternal embedding serviceKept costly embedding service, external data
ElasticsearchAlways-on warm disksExternal or pipelineToo expensive for rarely queried old meetings
Orion (Rust)Blob storage + local disk/RAM cacheBuilt into Orion10x cheaper, sub-second end-to-end, in-VPC

Turbopuffer used a similar blob-storage design, but it only stored vectors without generating them, forcing Circleback to retain its single largest search expense. Elasticsearch kept indexes on always-on disks for cold meetings that rarely receive queries, whereas Orion runs inside Circleback's own cloud account alongside existing microservices to share compute costs.

Advertisement

Tech Pulse Daily

Get tomorrow's pulse first

Join engineers who read Tech Pulse before stand-up. Free, weekday mornings.

03Blob storage indexes and per-meeting sharding

Orion stores its persistent index in immutable cloud blob storage such as Google Cloud Storage or Amazon S3, keeping frequently accessed segments cached in RAM and on local NVMe or disk. To ingest new text safely into immutable objects, Orion writes a new data file and atomically updates a small manifest file using compare-and-swap semantics so concurrent writers never overwrite one another.

A background compaction job later merges small incremental files into larger, faster-to-search segments. Orion also partitions indexes into shards that always keep each meeting in one deterministic place and assigns each meeting its own index section; at query time, Circleback's application computes user permissions and passes only the authorized meeting IDs, letting Orion open strictly the shards holding those meetings.

04Fixing Rust jemalloc leaks and Prisma bottlenecks

Early Orion benchmarks lagged expectations until systematic profiling exposed several runtime bugs. Notably, Rust's default memory allocator retained freed allocations aggressively, so switching to jemalloc delivered major memory-efficiency gains.

Running Orion in a shadow preview deployment next to production, the team tested more than 30 single-variable changes. Increasing memory, compressing network requests, and testing a quantized embedding model—which ran faster but degraded search quality—were all discarded. The biggest latency culprit turned out to be inside Circleback's Node application layer, where Prisma copied binary columns multiple times when reading large transcripts and triggered long garbage-collection pauses.

05Rollout metrics and 90% cost savings

By the end of shadow testing, chunk retrieval latency for large accounts dropped from roughly 700 milliseconds on unindexed Postgres scans to under 100 milliseconds in preview. Following full production rollout, most searches completed in under one second end-to-end, with Orion itself responding in tens of milliseconds.

Worst-case 20-to-40-second stalls and false-negative empty searches largely vanished. Circleback has since deleted the 1.7 TB pgvector table, shut down its external embedding service, and projects total search operating costs to fall to about 10% of the previous architecture.

Frequently asked questions

Why did Circleback move off PostgreSQL and pgvector?

Scanning 1.7 TB of unindexed vector chunks evicted application data from Postgres RAM, pushed worst-case queries to 20–40 seconds, and strained under 3.5 million monthly agent searches.

Why did Circleback build Orion instead of using Turbopuffer or Elasticsearch?

Turbopuffer still required paying for an external embedding service and sending data outside Circleback's cloud, while Elasticsearch required keeping always-on disks for rarely searched older meetings.

What unexpected performance bugs did Circleback find during the Orion rollout?

Switching Rust's default allocator to jemalloc cured excessive memory retention, and fixing Prisma's repeated copying of binary columns in Node eliminated long garbage-collection pauses.

How much faster and cheaper is Orion compared to the old stack?

Large-account chunk lookups fell from 700 ms to under 100 ms, end-to-end searches dropped under one second, and Circleback expects costs to fall to roughly one-tenth of prior levels.

Sources

Dillip Chowdary

Author

Dillip Chowdary

Writes Tech Bytes coverage of AI, engineering, and the tools that actually ship. Editor of Tech Pulse Daily.

Related on Tech Bytes

Advertisement

5-min tech signal

Weekday briefing for engineers who skip the noise.

No spam · Unsubscribe anytime

Advertisement

✈️ CareerPilot

Your AI job-search copilot

Match your resume against live Ashby, Greenhouse & Lever openings — fit scores, job-specific resume optimization and email alerts.

Find matching jobs →

Free Tools

Browse all tools →