pgvector

Store, index, and query vector embeddings in PostgreSQL with pgvector.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/aydadevelop/turborepo-starter --skill pgvector
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pgvector
Source: https://github.com/aydadevelop/turborepo-starter/tree/main/.agents/skills/pgvector
Command: npx skills add https://github.com/aydadevelop/turborepo-starter --skill pgvector

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and scripts (resource) components.

What problem does it solve?

This Skill enables powerful vector similarity search directly within your PostgreSQL database, eliminating the need for separate vector databases and simplifying your architecture.

Core Features & Use Cases

  • Vector Storage & Indexing: Store and index high-dimensional vector embeddings using HNSW or IVFFlat indexes.
  • Semantic Search: Implement features like RAG, semantic search, and image similarity search.
  • Hybrid Search: Combine keyword search (BM25) with vector search for more robust results.
  • Use Case: Integrate semantic search into your e-commerce platform to recommend products based on user queries or image similarity.

Quick Start

Use the pgvector skill to search for listings similar to 'modern minimalist furniture'.

Frequently Asked Questions about pgvector

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

FAQPage Schema
How do I perform vector similarity search directly in PostgreSQL?

You can perform vector similarity search in PostgreSQL using the pgvector extension to store, index, and query high-dimensional embeddings alongside your relational data. This eliminates the need for a separate vector database while supporting semantic search use cases.

Can I use Drizzle ORM to store and query vector embeddings?

Yes, Drizzle ORM integrates with the pgvector extension to store and query vector embeddings within PostgreSQL. This allows you to manage vector similarity search operations and build RAG retrieval pipelines directly through your TypeScript ORM layer.

What is the best way to build RAG retrieval without a dedicated vector database?

The best way to build RAG retrieval without a dedicated vector database is using pgvector in PostgreSQL. It supports HNSW and IVFFlat indexing for fast vector searches, enabling semantic retrieval while keeping your architecture simplified.

Does PostgreSQL pgvector support hybrid search with keyword and semantic results?

Yes, pgvector supports hybrid search by combining traditional keyword search like BM25 with vector similarity search. This approach queries both structured text and high-dimensional embeddings to deliver more robust and accurate search results.

What distance metrics are available for semantic search in pgvector?

pgvector supports cosine distance, L2 distance, and inner product distance metrics for semantic search. These metrics allow you to measure vector embedding similarity for various use cases, including RAG retrieval and image similarity matching.

When should I use HNSW vs IVFFlat indexes for vector search in PostgreSQL?

You should choose HNSW indexes for faster query performance with higher memory usage, or IVFFlat indexes for faster index builds and lower memory consumption. Both index types optimize vector similarity search in PostgreSQL for different scale requirements.