Cheat sheet · Specialise
Vector databases cheat sheet
Opens with creditsA quick-revision book on storing and searching embeddings: how similarity works, how approximate indexes trade recall for speed, and how to build retrieval that holds up in production. Examples use pgvector SQL and Python, and the ideas carry over to every dedicated vector store.
Chapters
9 chapters · 64 concepts
1Embeddings and similarityWhat a vector is in this world, where it comes from and the three ways of measuring how close two vectors are.8 concepts
- 1EmbeddingA fixed-length list of floating-point numbers that a model produces for a piece of text, an image or other data, placed so that similar meanings land close…
- 2Choosing an embedding modelThe model that maps input to vectors.
- 3DimensionsThe number of values in each vector, fixed by the model, commonly between 384 and 3072.
- 4Cosine similarityThe cosine of the angle between two vectors, from -1 (opposite) to 1 (same direction).
- 5Dot productThe sum of the element-wise products of two vectors.
- 6Euclidean distanceThe straight-line distance between two points: the square root of the summed squared differences.
- 7NormalisationScaling a vector to length 1 by dividing it by its norm.
- 8Semantic vs lexical searchSemantic search compares meaning through embeddings.
8 in this chapterOpen this chapter2Nearest neighbour searchFinding the k closest vectors to a query, exactly or approximately, and why approximate is usually the right call.6 concepts
- 1Exact k-nearest neighboursCompare the query with every stored vector and keep the k closest.
- 2Approximate nearest neighboursSearch with an index that visits only a small part of the data and returns most, but not always all, of the true nearest neighbours.
- 3Top-k and similarity thresholdsk is how many neighbours a query returns.
- 4Curse of dimensionalityIn high dimensions, distances between random points bunch together and classic space-partitioning structures such as k-d trees stop pruning much.
- 5Recall of an ANN indexThe share of the true top k neighbours, found by exact search, that the ANN search also returned. 0.95 means 95 of every 100 true neighbours were found.
- 6When exact search is enoughBelow roughly tens of thousands of vectors, or after a filter narrows the candidates to a few thousand, a full scan is often fast enough.
6 in this chapterOpen this chapter- Index types: HNSW, IVF and PQThe main ANN index families, what each one trades and the knobs that matter.8 conceptsOpens with credits
- Recall, latency and filteringTuning an index against real numbers, and combining vector search with ordinary conditions such as tenant, language or date.6 conceptsOpens with credits
- Hybrid search and rerankingCombining keyword and vector results, and using a stronger model to reorder the shortlist.7 conceptsOpens with credits
- Chunking for RAGRetrieval-augmented generation depends on what you store. How you cut documents into chunks decides what the model can ever be shown.7 conceptsOpens with credits
- pgvector in practiceVector search inside PostgreSQL: the column types, the distance operators and how to query it from Python.7 conceptsOpens with credits
- Dedicated stores and choosingThe main purpose-built vector databases, what sets each apart, and how to decide between them and Postgres.7 conceptsOpens with credits
- Evaluation and operationsMeasuring retrieval quality, and running vectors over time as models, data and costs change.8 conceptsOpens with credits
- 10Glossary, A to ZEvery concept in the sheet and the smaller terms it uses, in one list.88 terms
About this sheet
Embeddings, similarity metrics, ANN indexes, filtering, hybrid search, reranking, RAG chunking, pgvector, dedicated stores and evaluation.
Related on Sefism
Picked from the other libraries by shared topics.
Roadmaps
See allBest practices
See all- PostgreSQL Best PracticesDesign, index, query and run PostgreSQL well: data types, constraints, EXPLAIN, zero-downtime migrations, pooling, transactions, backups and roles.
- MongoDB Best PracticesModel, index, query and run MongoDB well: access-pattern schemas, validation, the ESR rule, aggregation limits, write concern, transactions, drivers and security.
- Data Pipeline Best PracticesHow to build data pipelines you can re-run, test and trust: idempotent tasks, orchestrator hygiene, layered transformations, data tests, freshness, ownership and monitoring.
Checklists
See allProject structures
See all- NestJS project structureFor people who want a structured TypeScript backend with clear rules about where code goes. Every feature is a Nest module that owns its controller, service, DTOs, entities and tests, so the app grows by adding folders, not by stretching old ones. The tree follows one orders API from nest new to a codebase a whole team can run for years.
- FastAPI project structureA typed Python API for an orders app, built the way the FastAPI docs and the official full stack template lay it out: one
apppackage, a router per feature, Pydantic schemas at the edges, services in the middle and SQLAlchemy models with Alembic migrations underneath. For students who have finished the FastAPI tutorial and want to know where the second, tenth and fiftieth file go. - Django project structureFor students building their first serious Python web app or API with Django, and for the team that keeps it running years later. The project is a thin "config" package plus one Django app per business area (accounts, catalog, orders, core), each owning its models, services, views, API, migrations and tests. Settings come from validated environment variables, and the tree grows from the tutorial layout to CI, containers, observability and enforced module boundaries.
Career questions
See all- Should I use PostgreSQL or MongoDB for my project?For most student and startup projects, PostgreSQL is the safer default: relational data, joins, constraints and transactions fit most apps, and it handles JSON and vector search too. MongoDB is a good fit when your data is naturally document-shaped and varies a lot, or your team already knows it well. Model your data first, then choose.
- Do I need a vector database for my AI project?Often not. For a student project or a small app, a vector extension on a database you already use (such as pgvector in PostgreSQL), or even an in-memory index, is enough. A dedicated vector database earns its place with very large collections, heavy query traffic, or features like advanced filtering and multi-tenancy at scale.
- Should I use Firebase or Supabase for my app?Both let you ship an app fast with auth, a database, storage and hosting-style services. Supabase is built on PostgreSQL, so it suits relational data and SQL skills you will reuse anywhere. Firebase is a mature Google platform with a document database and strong mobile tooling. Choose by your data shape, your platform, and how much you want to learn transferable database skills.
Stuck on something specific?
Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.
- 1:1 Mentorship
- Fresh Graduate Mentorship
- Career Guidance
Brand deals, promos and partnerships: tauseeffayyaz@gmail.com