█

AI/TLDR

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

pgvecto.rs

Rust में लिखा Postgres एक्सटेंशन, जो वेक्टर समानता खोज (vector similarity search) की सुविधा देता है

Vector Databasesओपन सोर्स
भाषा
Rust
$docker run \
संक्षेप में

pgvecto.rs क्या है?

pgvecto.rs Rust में लिखा Postgres एक्सटेंशन, जो वेक्टर समानता खोज (vector similarity search) की सुविधा देता है. यह Retrieval & Knowledge (RAG) टूल्स की Vector Databases श्रेणी में आता है; ओपन सोर्स है और Rust में लिखा गया है। शुरू करने के लिए: docker image चलाएँ.

सारांश

pgvecto.rs एक PostgreSQL एक्सटेंशन है, जो आपके डेटाबेस में वेक्टर समानता खोज जोड़ता है। यह pgrx framework के ऊपर Rust में लिखा गया है, और यह Postgres को एक नया vector(n) डेटा टाइप तथा distance operators देता है, ताकि आप सामान्य SQL का इस्तेमाल करके embeddings स्टोर और क्वेरी कर सकें।

यह उन developers के लिए बना है जो पहले से PostgreSQL चलाते हैं और अलग vector store सेट अप करने के बजाय अपने embeddings को अपने relational डेटा के साथ ही रखना चाहते हैं। यह 65535 dimensions तक सपोर्ट करता है, binary vectors, FP16 और INT8 जैसे अतिरिक्त टाइप देता है, और VBASE method के ज़रिये वेक्टर खोज को filters और joins के साथ जोड़ता है।

ध्यान दें कि इस प्रोजेक्ट की जगह अब VectorChord ले चुका है, जिसे maintainers (TensorChord) बेहतर स्थिरता और परफ़ॉर्मेंस वाला बताते हैं। नए काम के लिए VectorChord इस्तेमाल करने की सलाह दी जाती है, और इसके लिए माइग्रेशन गाइड भी उपलब्ध है, लेकिन pgvecto.rs अपने README में बताए अनुसार अब भी इस्तेमाल किया जा सकता है।

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

  • PostgreSQL में vector(n) डेटा टाइप जोड़ता है, जो 65535 dimensions तक सपोर्ट करता है
  • तीन distance operators: squared Euclidean (<->), negative dot product (<#>), और cosine distance (<=>)
  • वेक्टर खोज को relational queries के साथ जोड़ने के लिए VBASE method (TopK + filter + join)
  • अतिरिक्त डेटा टाइप, जिनमें binary vectors, FP16 (vecf16) और INT8 शामिल हैं, ताकि memory का उपयोग कम हो
  • Runtime SIMD dispatch, जो होस्ट CPU के आधार पर instructions चुनता है
  • Index डेटा को PostgreSQL के अपने storage engine से अलग स्टोर करता है

शुरू करें

सबसे तेज़ रास्ता आधिकारिक Docker image है, जिसमें extension पहले से build किए हुए Postgres के साथ आता है। इसके बाद extension enable करें और plain SQL में vector queries चलाएँ।

Docker image चलाएँ

pgvecto.rs पहले से इंस्टॉल वाला Postgres container शुरू करें। डिफ़ॉल्ट user postgres है और password वही है जो आप यहाँ सेट करते हैं।

bashbash
docker run \
  --name pgvecto-rs-demo \
  -e POSTGRES_PASSWORD=mysecretpassword \
  -p 5432:5432 \
  -d ghcr.io/tensorchord/pgvecto-rs:pg17-v0.4.0

कनेक्ट करें और extension enable करें

psql से कनेक्ट करें, फिर vectors extension बनाएँ ताकि vector type और operators उपलब्ध हो जाएँ।

bashbash
psql -h localhost -p 5432 -U postgres

vector column वाली table बनाएँ

Extension enable करें और एक table परिभाषित करें जिसमें embeddings एक vector column के रूप में रहें।

sqlsql
DROP EXTENSION IF EXISTS vectors;
CREATE EXTENSION vectors;

CREATE TABLE items (
  id bigserial PRIMARY KEY,
  embedding vector(3) NOT NULL -- 3 dimensions
);

Vectors insert करें और खोजें

कुछ embeddings insert करें, फिर किसी distance operator से order करें ताकि सबसे नज़दीकी matches मिल सकें।

sqlsql
INSERT INTO items (embedding)
VALUES ('[1,2,3]'), ('[4,5,6]');

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

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

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

  • जो app पहले से PostgreSQL इस्तेमाल करता है, उसमें text या image embeddings पर semantic search जोड़ें
  • एक retrieval-augmented generation (RAG) या question-answering backend बनाएँ, जो embeddings को relational डेटा के साथ रखे
  • अलग vector database के बजाय, एक ही Postgres query में SQL filters और joins के साथ vector similarity queries चलाएँ
  • High-dimensional डेटा पर FP16 (vecf16), INT8 या binary vector types से embedding memory footprint घटाएँ

How pgvecto.rs compares

pgvecto.rs 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
pgvecto.rs★ 2.2kRust में लिखा Postgres एक्सटेंशन, जो वेक्टर समानता खोज (vector similarity search) की सुविधा देता है