llama-index-vector-stores-postgres
llama-index vector_stores postgres integration
Decision gist · record as of 2026-08-14
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.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a running PostgreSQL instance with pgvector extension installed and configured.
- 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+).
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions—suitable for most projects.
last release 2026-03-13 (154 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 527,763 downloads/mo, #6,169 on PyPI
Alternatives
Verify before relying
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,
)- 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.
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 on this page. Verify before relying on it.
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
llama-index-vector-stores-postgres on PyPI
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.
Requires a running PostgreSQL instance with pgvector extension installed and configured.
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,
)
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 the current Python release <4.0,>=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 5 packagesasyncpgllama-index-corepgvectorpsycopg2-binarysqlalchemy |
| Maintenance | Actively maintained 154 days since the last release |
| First released | |
| Downloads | 527,763 / month, #6,169 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: llama_index_vector_stores_postgres-0.8.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “postgres vector store”
- llama-index-vector-stores-postgresIntegrates PostgreSQL with pgvector extension as a vector store…
- llama-index-storage-docstore-postgresProvides a Postgres-backed document store integration for LlamaIndex,…
- langchain-postgresProvides LangChain abstractions for vector storage, chat history, and…
Give your agent the search over MCP, or paste the wish link into any chat.
More Database packages
psycopg2-binary is a PostgreSQL database adapter for Python that implements the DB API 2.0 specification, enabling Python applications to connect to and query PostgreSQL databases with thread-safe concurrent operations.
Python client library for connecting to and executing commands against Redis key-value stores, supporting both synchronous and asynchronous operations.
Install it if your application needs to interact with Redis; the only prerequisite is a running Redis server instance.
YDB Python SDK is the official client library for connecting to and querying YDB databases from Python applications.
Install it if you need to connect Python applications to YDB databases.
Connects Python applications to Snowflake data warehouses using the DB API 2.0 specification, enabling SQL queries, data transfers, and warehouse operations.
sqlparse tokenizes SQL text into a tree of statements, clauses, and expressions, and provides functions to split scripts, format queries, and inspect parsed tokens without validating dialect or syntax.
Install it if you need to manipulate, format, or analyze SQL text programmatically.
Provides base adapter protocols and shared functionality that database adapters use to integrate with dbt-core, handling connections, dialect translation, relation caching, and core interface management.
See also llama-index-vector-stores-redis · llama-index-vector-stores-faiss · vecs · langchain-postgres · llama-index-vector-stores-qdrant · llama-index-vector-stores-chroma · llama-index-retrievers-bm25 · llama-index-vector-stores-milvus · pgserver · sqlite-vec