█

AI/TLDR

मुझे पिलाएं कॉफ़ी
मुझे एक कॉफ़ी पिलाएँ

pg_vectorsearch

PostgreSQL के अंदर तेज़ vector search के लिए partition-based PRISM index

Vector Databasesओपन सोर्स
अपडेट किया गया
13 अक्टू॰ 2026
भाषा
C
लाइसेंस
PostgreSQL
कवरेज
1 story
$git clone https://github.com/timescale/pg_vectorsearch.git

नया क्या है

13 अक्टू॰ 2026

Tiger Data announced pg_vectorsearch in alpha, with the PRISM index and benchmarks showing 100M-vector builds in under two hours where pgvector's HNSW took 42 hours. pgvectorscale moves to maintenance mode.

ताज़ा खबरें

संक्षेप में

pg_vectorsearch क्या है?

pg_vectorsearch PostgreSQL के अंदर तेज़ vector search के लिए partition-based PRISM index. यह Retrieval & Knowledge (RAG) टूल्स की Vector Databases श्रेणी में आता है; ओपन सोर्स है, C में लिखा गया है और PostgreSQL लाइसेंस के तहत है। शुरू करने के लिए: extension build और install करें.

अपडेट किया गया Markdown वर्शन ↗

सारांश

pg_vectorsearch, Tiger Data (Timescale के पीछे की कंपनी) का बनाया एक ओपन सोर्स PostgreSQL extension है, जो approximate nearest neighbor (ANN) vector search के लिए है। इसमें PRISM (Partitioned Routing Index for Similarity Matching) नाम का index type जुड़ता है, एक IVF-style index जिसमें hierarchical routing है और जो 100 million vectors या उससे ज़्यादा के collections के लिए बनाया गया है।

Bar chart of index build time: at 100M vectors PRISM builds in 1 h 40 min on 128 GiB and 49 min on 512 GiB while HNSW does not finish or takes 42 h; at 1M vectors PRISM takes about 3 min while HNSW does not finish or takes about 21.7 h.
Index build time from Tiger Data's launch benchmark: PRISM against pgvector's HNSW (halfvec) on the same machines.Tiger Data, Announcing pg_vectorsearch ↗

HNSW जो graph बनाता है, उसकी जगह PRISM समान vectors को k-means partitions में समूहबद्ध करता है और compressed RaBitQ codes स्टोर करता है। इन codes में हर dimension के लिए लगभग एक bit होता है, और इन्हें database pages में पैक किया जाता है। Query cluster centroids के एक छोटे tree से होकर गुजरती है और फिर SIMD (AVX2, AVX512 या NEON) से सबसे नज़दीकी partitions को scan करती है। Partition की सीमा के पास वाले vectors को recall बढ़ाने के लिए एक से ज़्यादा partition में स्टोर किया जा सकता है, और error bounds वाला two-stage search full-precision reranking की ज़रूरत को सीमित करता है।

यह extension अपने `vec32` और `vec16` types के साथ काम करता है, और मौजूदा pgvector के `vector` व `halfvec` columns को सीधे index कर सकता है। इसलिए pgvector इस्तेमाल करने वाली table अपना schema और queries जस के तस रखती है। Tiger Data इसे pgvectorscale के successor के रूप में पेश करता है, और कंपनी के अनुसार pgvectorscale maintenance mode में जा रहा है। यह project alpha के रूप में चिह्नित है: README के अनुसार यह testing के लिए है, production के लिए नहीं, और prereleases के बीच indexes को दोबारा बनाना चाहिए।

यह क्या करता है

  • PRISM index: hierarchical centroid routing के साथ k-means partitions, 100M+ vectors के लिए बनाया गया
  • RaBitQ quantization, दो-चरणीय (two-stage) और error-bounded search के साथ, जो full-precision reranking को कम करता है
  • AVX2, AVX512 और NEON पर SIMD distance computation
Bar chart of P50 query latency on 100M Cohere embeddings: at 95% recall PRISM takes 6 ms on 128 GiB and 4 ms on 512 GiB versus 8 ms for HNSW on 512 GiB; at 99% recall PRISM takes 21 ms and 19 ms while HNSW is not achieved.
Query latency at 100 million vectors: PRISM on a 128 GiB machine against HNSW on four times the hardware.Tiger Data, Announcing pg_vectorsearch ↗
  • मौजूदा pgvector vector और halfvec columns को table दोबारा लिखे बिना index करता है
  • vec32/vector और vec16/halfvec के लिए L2, inner-product और cosine operator classes
  • एक मुख्य tuning knob, prism.nprobe, जहाँ 0 का मतलब है कि लगभग 95% recall अपने-आप लक्ष्य होता है
  • Inserts, updates और deletes, जिनमें बड़ी posting lists को prism_rebalance या REINDEX से split किया जाता है

शुरू करें

pg_vectorsearch को Meson से source से build किया जाता है। इसके लिए development headers के साथ PostgreSQL 18 या उसके बाद का संस्करण और C11 compiler (GCC 11+ या Clang 14+) चाहिए। Index बनाने से पहले अपना data load करें, क्योंकि index का साइज़ row count से तय होता है।

Extension build और install करें

Repository clone करें और उसे release mode में build करें। CBLAS वैकल्पिक है, लेकिन यह RaBitQ encoding को तेज़ करता है।

bashbash
git clone https://github.com/timescale/pg_vectorsearch.git
cd pg_vectorsearch
meson setup builddir --buildtype=release
meson install -C builddir

Table बनाएँ और vectors load करें

Extension enable करें और embeddings को vec32 column में स्टोर करें (storage आधा करने के लिए vec16 इस्तेमाल करें)।

sqlsql
CREATE EXTENSION pg_vectorsearch;

CREATE TABLE items (
    id serial PRIMARY KEY,
    embedding vec32(3) STORAGE PLAIN
);

INSERT INTO items (embedding)
SELECT ARRAY[i::real, (i % 7)::real, (i % 5)::real]::vec32
FROM generate_series(1, 1000) i;

PRISM index बनाएँ और उस पर query करें

Operator class के साथ index बनाएँ, ज़्यादा recall के लिए चाहें तो nprobe बढ़ाएँ, फिर distance के हिसाब से order करें।

sqlsql
CREATE INDEX ON items USING prism (embedding vec32_l2_ops);

SET prism.nprobe = 40;  -- 0 = auto (about 0.95 recall)

SELECT * FROM items
ORDER BY embedding <-> '[3,1,2]'
LIMIT 5;

या मौजूदा pgvector table को index करें

PRISM pgvector के vector और halfvec columns को सीधे पढ़ता है। vector_<metric>_ops को vec32_<metric>_ops से बदलें (halfvec के लिए vec16), EXPLAIN से जाँचें कि planner उसका इस्तेमाल कर रहा है, और फिर पुराना HNSW index हटा दें, अगर उसकी ज़रूरत नहीं है।

sqlsql
CREATE EXTENSION vector;
CREATE EXTENSION pg_vectorsearch;

CREATE INDEX documents_embedding_prism
    ON documents USING prism (embedding vec32_l2_ops);

कमांड और कोड प्रोजेक्ट के अपने दस्तावेज़ों से लिए गए हैं — हमेशा जांचें आधिकारिक repo ताज़ा जानकारी के लिए।

कब इस्तेमाल करें

  • अलग vector database के बिना PostgreSQL के अंदर 100M+ embeddings पर vector search चलाना
  • pgvector के उस HNSW index को बदलना, जो बनाने में बहुत धीमा है या उपलब्ध memory के लिए बहुत बड़ा है
  • छोटे, सस्ते database instances पर उच्च recall के साथ RAG retrieval चलाना
  • Migration से पहले मौजूदा pgvector setup के साथ partition-based ANN index को परखना

How pg_vectorsearch compares

pg_vectorsearch alongside other open-source vector databases tools AI/TLDR tracks, ranked by GitHub stars.

टूलस्टारयह क्या करता है
Supabase★ 116kManaged Postgres backend whose Vector toolkit (pgvector) stores, indexes, and queries embeddings next to transactional data.
Redis Cloud★ 77.9kFully-managed Redis with built-in vector search, offering low-latency similarity and hybrid queries over any embeddings.
Milvus★ 46.8kअरबों embeddings में बड़े पैमाने पर खोज के लिए एक ओपन सोर्स वेक्टर डेटाबेस
FAISS★ 42kdense vectors पर कुशल similarity search और clustering के लिए लाइब्रेरी
Qdrant★ 35.9kRust में लिखा, समृद्ध payload फ़िल्टरिंग वाला सिमेंटिक सर्च के लिए वेक्टर सर्च इंजन
Chroma★ 29.8kओपन सोर्स एम्बेडिंग डेटाबेस, जो रिट्रीवल और RAG फ़ीचर बनाने में मदद करता है
pgvector★ 23.9kPostgres के लिए ओपन सोर्स वेक्टर similarity search
pg_vectorsearch★ 459PostgreSQL के अंदर तेज़ vector search के लिए partition-based PRISM index