A vector database stores vector embeddings and supports efficient similarity searches over vectorized data. It commonly supplies specialized indexes that speed up these searches. section 8.3 section 8.6
Postgres becomes a vector database when the pgvector extension adds the vector data type, similarity operators, and specialized vector indexes. section 8.2 section 8.7
A vector database supports an embedding-based application flow:
- Split target text into chunks when necessary and send the chunks to an embedding model. section 8.3
- Store the generated embeddings in Postgres and retrieve relevant records through vector similarity search. section 8.3 section 8.6
- Use retrieved context to augment an LLM through retrieval-augmented generation. section 8.6
Run Postgres with pgvector
Create a Docker volume, start the pgvector/pgvector:0.8.0-pg17 image on port 5432, connect with psql, and run CREATE EXTENSION vector;. section 8.2
Figure 8.10 Implementing RAG with an LLM, an embedding model, and Postgres
Trace how a chatbot sends a prompt to a backend, retrieves context from Postgres, and uses an embedding model and LLM to generate a response. section 8.6

























