Vector Databases & RAG Cheat Sheet

This content was generated with the assistance of AI and should be verified against the official documentation of each tool and framework before being relied on in production.

This section’s bibliography lists the reference material consulted while preparing these pages.

A single-page index of quick back-links to every page in this section, grouped the same way as the section itself — handy for jumping straight to the topic you need instead of paging through the full navigation.

The downloadable PDF is a separate, single A4 page meant for printing. It states the version baseline this section targets (Python 3.12, sentence-transformers 6.1, FAISS 1.15.1, sqlite-vec 0.1.9, pgvector 0.8.6, Ollama 0.34, LangChain 1.4 / langchain-core 1.6 / LangGraph 1.2, LangChain4j 1.20.1, Spring Boot 4.1 / Spring AI 2.0.1 and RAGAS 0.4.3) and covers:

  • an engine comparison matrix — pgvector, sqlite-vec, Qdrant, Milvus, Weaviate, Pinecone, Redis, Elasticsearch, MongoDB Atlas, Neo4j and Couchbase — with best fit, scaling, index location, pricing model and AWS / Google Cloud / Azure availability;

  • vector database categories and embedding rules (normalization, one model for corpus and query, Matryoshka truncation, re-embedding);

  • similarity metrics with their formulas (L2, inner product, cosine distance, L1) and the matching pgvector operators, sqlite-vec distance_metric values and FAISS index classes;

  • ANN indexes (Flat, IVF, HNSW) with the HNSW per-vector memory estimate, quantization (scalar, product, binary), filtering strategies, and hybrid search with the Reciprocal Rank Fusion formula and re-ranking;

  • pgvector and sqlite-vec essentials (index DDL, query-time settings, vec0 KNN queries);

  • the RAG pipeline, chunking rules of thumb, retrieval strategies, prompt rules, the agentic RAG loop, and agent memory and semantic caching;

  • LangChain / LangChain4j and Spring AI one-liners, evaluation metrics (Recall@k, MRR, nDCG, RAGAS), and a production and security checklist.

Filtering, hybrid search & relevance — Metadata Filtering and Hybrid Search & Re-ranking.

Vector search in SQL databases & choosing an engine — Vector Search in SQLite, PostgreSQL & pgvector, The Vector Database Landscape, and Comparing Vector Databases.

Quality & operations — Evaluating RAG Systems and Production Considerations.