TiloBox
Back to directory
LicensePostgreSQL
GitHub stars14.2k
Last commit1 weeks ago
Tags6 topics
LlmAiEmbeddingsPostgresqlVector SearchDatabase
Overview

Why consider pgvector?

pgvector is an open-source PostgreSQL extension that adds vector data types, exact and approximate nearest neighbor search (HNSW, IVFFlat), and L2/cosine distance operators to PostgreSQL.

Guided learning

Learn pgvector by building

Practical setup notes, real use cases, and copy-ready examples in one focused guide.

1 min read 3 sections
In this guide3 sections

Overview of pgvector

pgvector transforms standard PostgreSQL instances into full vector databases. It allows developers to store vector embeddings directly alongside their relational application tables, eliminating the need to maintain separate vector databases.

Enabling the Extension

In your PostgreSQL database:

sql
1CREATE EXTENSION vector;

Storing and Indexing Embeddings

Create a table with a 1536-dimensional vector column (OpenAI embedding size):

sql
1CREATE TABLE documents (
2 id bigserial PRIMARY KEY,
3 content text,
4 embedding vector(1536)
5);
6
7-- Create an HNSW index for ultra-fast vector similarity search
8CREATE INDEX ON documents USING hnsw (embedding vector_cosine_ops);

Query nearest neighbors using cosine similarity:

sql
1SELECT content, 1 - (embedding <=> '[0.012, -0.045, ...]') AS similarity
2FROM documents
3ORDER BY embedding <=> '[0.012, -0.045, ...]'
4LIMIT 5;

pgvector is licensed under the PostgreSQL License.

Related tools

More options with a similar category or technology profile.

pgvector FAQs

pgvector is listed as a Ai Machine Learning tool on TiloBox. Review the overview, features, and official documentation on this page to decide whether it solves your specific workflow.

Start with the project's GitHub repository for supported installation and deployment instructions. Test the setup with representative data or a small project before rolling it out more widely.

pgvector is listed under the PostgreSQL license. Read the complete license text and the project's notices before using, modifying, or distributing the software.

Production readiness depends on your requirements. Review maintenance activity, security practices, documentation, backup and upgrade procedures, and compatibility with your stack; then validate it in a non-production environment.

pgvector is listed as an alternative to Weaviate. Compare the core workflow, deployment model, integrations, and licensing against your must-have requirements before switching.