pgvector-semantic-search

Store embeddings in PostgreSQL and query them via nearest-neighbor distance.

7|1|Updated Feb 24, 2026
One-click install
npx skills add https://github.com/1lastphoenix/ton-ai-audit --skill pgvector-semantic-search-1lastphoenix
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pgvector-semantic-search
Source: https://github.com/1lastphoenix/ton-ai-audit/tree/main/.agents/skills/pgvector-semantic-search
Command: npx skills add https://github.com/1lastphoenix/ton-ai-audit --skill pgvector-semantic-search-1lastphoenix

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

PostgreSQL users who want to add high-performance semantic search can store embeddings in the database and perform fast similarity queries using pgvector, enabling scalable retrieval within-DB for AI workloads.

Core Features & Use Cases

  • Store embeddings as vector columns (halfvec) and index with HNSW or IVFFlat for fast nearest-neighbor search.
  • Implement Retrieval-Augmented Generation (RAG) workflows by fetching relevant documents via vector similarity.
  • Tune performance with quantization strategies and index parameters (m, ef_construction, ef_search) for memory-speed tradeoffs.

Quick Start

Install the pgvector extension, create a vector column, and build an HNSW index to begin performing semantic searches.

Frequently Asked Questions about pgvector-semantic-search

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I perform semantic search in PostgreSQL using pgvector?

Semantic search in PostgreSQL with pgvector stores embeddings as halfvec vector columns and queries them via nearest-neighbor distance. You build HNSW or IVFFlat indexes on the vector columns to enable fast similarity retrieval across large corpora.

Does pgvector support building RAG workflows directly in PostgreSQL?

Yes, pgvector supports Retrieval-Augmented Generation by fetching relevant documents via vector similarity queries. You store text embeddings in PostgreSQL and retrieve the most similar documents using nearest-neighbor distance to ground AI responses.

What is the best way to tune pgvector index performance for large-scale vector search?

Tune pgvector performance by adjusting HNSW index parameters like m and ef_construction, plus ef_search for query speed. Apply quantization strategies such as binary quantization with bit arrays to optimize the memory-speed tradeoff for large corpora.

Can I use halfvec and binary quantization with HNSW indexes in pgvector?

Yes, pgvector supports storing embeddings as halfvec(N) columns and bit arrays for quantized vectors. You can build HNSW or IVFFlat indexes on these vector columns to optimize memory usage while maintaining fast nearest-neighbor search performance.

What PostgreSQL and pgvector versions are required for HNSW and IVFFlat vector search?

HNSW and IVFFlat vector search requires PostgreSQL with the pgvector 0.8.0 or later extension enabled. You must define vector columns as halfvec(N) or bit arrays and configure index parameters like m and ef to execute nearest-neighbor queries.