--- id: llama-index-vector-stores-postgres version: "0.8.1" license: MIT license_treatment: permissive maintenance: active --- # llama-index-vector-stores-postgres — llama-index vector_stores postgres integration License: permissive · Maintenance: active · Downloads: 527.8K/mo ## What it is and what it does This package bridges LlamaIndex and PostgreSQL by providing a vector store adapter that leverages the pgvector extension for storing and querying embeddings. It wraps the underlying database operations (via sqlalchemy, psycopg2-binary, and asyncpg) into a LlamaIndex-compatible interface, letting you use PostgreSQL as your embedding backend instead of a specialized vector database. The integration supports five query modes: DEFAULT (standard similarity), HYBRID (dense + sparse), SPARSE (BM25 text), TEXT_SEARCH (full-text), and MMR (maximal marginal relevance for diverse results). You configure it by pointing to a PostgreSQL database and table, specifying embedding dimension, and then instantiate a PGVectorStore object that integrates directly with LlamaIndex's index and query engine APIs. Use it for: - Store and retrieve embeddings from PostgreSQL when you already have Postgres infrastructure and want to avoid a separate vector database. - Implement hybrid search combining dense vector similarity with sparse BM25 text retrieval on the same dataset. - Use MMR queries to retrieve diverse, relevant results—useful for summarization or multi-faceted information retrieval. - Build full-text search on embeddings using PostgreSQL's native text search capabilities alongside vector operations. - Integrate vector search into existing LlamaIndex applications that already use Postgres for other data. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Integrates PostgreSQL with pgvector extension as a vector store backend for LlamaIndex, supporting multiple query modes including similarity search, hybrid retrieval, BM25 sparse search, full-text search, and maximal marginal relevance. Yes, if you are building a LlamaIndex application and have PostgreSQL with pgvector already available. The package is actively maintained, has no known vulnerabilities, and low install friction. It is most valuable when you want to avoid adding a separate vector database and can leverage existing Postgres infrastructure. Not necessary if you prefer a dedicated vector store or do not use LlamaIndex. ## Install pip install llama-index-vector-stores-postgres uv add llama-index-vector-stores-postgres poetry add llama-index-vector-stores-postgres ## Installing llama-index-vector-stores-postgres Before you install: Low install friction with a pure-Python wheel and five runtime dependencies. Actively maintained as of 2026-03-13, with current Python support (3.10+). No known vulnerabilities. License in practice: MIT license permits commercial and private use with minimal restrictions—suitable for most projects. Quickstart: pip install llama-index-vector-stores-postgres from llama_index.vector_stores.postgres import PGVectorStore vector_store = PGVectorStore.from_params( database="your_database", host="localhost", password="your_password", port="5432", user="your_user", table_name="your_table", embed_dim=1536, ) Requires a running PostgreSQL instance with pgvector extension installed and configured. Verify before relying: - Performance characteristics and scalability limits for large embedding collections. - Specific version compatibility matrix between llama-index-core and this integration. - Whether MMR query mode requires additional dependencies or configuration beyond pgvector. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 527.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags postgres vector store, pgvector llama index, postgresql embedding storage, vector database postgres, semantic search postgres, hybrid retrieval postgres, mmr search postgres, vector-search, embeddings, postgres-integration [View on SkillFed](https://skillfed.io/packages/llama-index-vector-stores-postgres) · [View on PyPI](https://pypi.org/project/llama-index-vector-stores-postgres/)