This week's AI tool: pgvector , an open-source Postgres extension that adds vector similarity search to the database you probably already run.
Why it's worth 15 minutes of your time: the retrieval step of a RAG app is "store embeddings, find the nearest ones to a query, filter by who is allowed to see what." If your documents, users and permissions already live in Postgres, pgvector lets you do all three in one SQL query, with the transactions, backups, JOINs and point-in-time recovery you already rely on. No second database to sync.
Here's exactly how to use it.
1. Install and enable the extension
pgvector supports Postgres 13+. It's available through Docker, Homebrew, APT, Yum, PGXN and conda-forge, and it comes preinstalled on many hosted Postgres providers (see the installation section of the README ). Then, once in each database where you want it:
CREATE EXTENSION vector ;
Enter fullscreen mode
Exit fullscreen mode
2.…