Mike MurphyAI Handyman
Subscribe
Back to tutorials

How To Enable pgvector on Neon Postgres for RAG

October 22, 2025 ·

In this tutorial, you will learn how to enable the pgvector extension to convert your Neon Postgres database into a vector database. This allows you to store and earch vector embeddings, which are necessary components when building Retrieval Augmented Generation (RAG) systems. The tutorial uses the Neon SQL editor for all the necessary steps.

Description

In this tutorial, you will learn how to enable the pgvector extension to convert your Neon Postgres database into a vector database. This allows you to store and earch vector embeddings, which are necessary components when building Retrieval Augmented Generation (RAG) systems. The tutorial uses the Neon SQL editor for all the necessary steps.

Vector Store:
The database or table that holds your embeddings and metadata

Embeddings:
The numeric representation of text, image, or audio content

RAG System:
Process that searches vector store for relevant embeddings and then feeds to LLM for outputs.

pgvector:
Postgres extension that enables Postgres to store embeddings/vectors.

In this tutorial, you’ll learn:

  • How To Use the SQL Editor
  • How To Save SQL Queries
  • How To Enable pgvector extension
  • How To Verify pgvector is enabled
  • How to create a table to store embeddings
  • How to add vector index
  • How to insert test row data
  • How To run Similarity Search

Neon Account Sign-Up:
https://neon.com

The pgvector extension (Neon Documentation):
https://neon.com/docs/extensions/pgvector

How To Create Neon Postgres Database Tutorial:
https://youtu.be/doIFdMp7D2E

——————
✅ Chapters:
00:00 Intro: About The Tutorial
00:32 What You Will Learn
00:52 Prerequites
01:11 Tutorial: How To Setup Neon Database
01:24 Step 1: Open SQL Editor
01:35 Sign In To Neon.com
01:49 Open Projects Dashboard
01:58 Open SQL Editor
02:07 Select Database
02:29 Step 2: Enable pgvector
02:41 Neon Docs (pgvector)
03:02 IF NOT EXISTS
03:49 SQL Editor: Enable pgvector
04:22 RUN Command
04:42 Step 3: Verify pgvector is enabled
04:50 SQL Editor Basics
05:15 Add Comments in SQL Editor
05:53 How To Run Commands
06:13 Step 4: Create Embeddings Table
06:42 Create Table Code Overview
07:27 Embedding Vector (Dimension)
08:05 LLM Embedding Models
08:55 Confirm Table Was Inserted
09:14 Save Query
09:55 Step 5: Add Vector Index
10:42 Ivfflat little date warning
10:58 Step 6: Insert Test Row
11:41 Embedding Vector (4) for Demo
12:19 Documents_Demo Table
12:33 Embedding Dimension in Header
12:59 Create New Query
13:33 Confirm Test Data Row
13:50 Similarity Search
14:15 How RAG Works
15:39 Similarity Search Test

🪜 How To Enable PGVECTOR Extension on Neon Postgres Database:

  1. Sign into https://neon.com
  2. Open the SQL Editor
  3. Log in to your Neon dashboard
  4. Select your organization
  5. Click ‘Projects,’ open your project
  6. Click the ‘SQL editor’ and select correct database
  7. Copy/Paste CREATE EXTENSION vector IF NOT EXISTS) into the SQL editor.
  8. Press ‘Run’ to enable pgvector
  9. Verify the Extension to confirm that the pgvector extension is successfully enabled.
  10. Create the Vector Store Table (documents)
  11. Ensure the embedding vector dimension number (e.g., 1536) matches the dimension used by your chosen Large Language Model.
  12. Add a Vector Index: Copy and run the code snippet to add a vector index to your new table, which will speed up similarity searches.
  13. Test the Functionality: Insert a test row of sample data
  14. Run a similarity search query to ensure the database can correctly make a match between text and vectors.

AI Unplugged · weekly

Newsletter for AI Builders

One practical email with the news, tools, terms, and tutorials worth remembering. Beehiiv sends it; Astro owns the archive.

No spam. Reply-friendly. Easy to leave.