Vector embeddings and vector databases
grasp of embeddings and ANN search.
an embedding is a learned dense vector capturing semantic meaning, and vector DBs use ANN indexes like HNSW for fast similarity search that relational B-trees cannot provide.
WHAT THIS TESTS This checks whether you understand what embeddings represent and why high-dimensional similarity search demands purpose-built indexing rather than a relational column.
A GOOD ANSWER COVERS A vector embedding is a dense, fixed-length array of floating-point numbers produced by a machine learning model, mapping an item, such as text, an image, or audio, into a high-dimensional space where geometric closeness reflects semantic similarity. Two sentences with similar meaning land near each other even if they share no words. Similarity search means finding the vectors nearest to a query vector under a distance like cosine or Euclidean.
WHY A SPECIALIZED DATABASE You can store a vector as a column in a relational database, but the standard indexes, B-trees and hash indexes, only accelerate equality and range queries on scalar values; they cannot index nearest-neighbor search in hundreds or thousands of dimensions. So a naive SQL query computing distance to every row and sorting is a full O(n) scan, which collapses at millions of vectors. Vector databases, and vector extensions, implement approximate nearest neighbor indexes such as HNSW, IVF, or product quantization that trade a little recall for sublinear query time, plus features like metadata filtering, sharding, and efficient bulk ingestion tuned for embeddings.
NUANCE Modern relational systems with extensions like pgvector can do ANN too, blurring the line; the real distinction is having an ANN index and embedding-centric tooling, not the relational versus non-relational label.
LIKELY FOLLOW-UPS What is HNSW. Cosine versus Euclidean distance. How do you filter by metadata and vector together. What is recall in ANN.
ONE CONCRETE EXAMPLE A semantic document search embeds each document with a model into 768-dimensional vectors stored in a vector database with an HNSW index. A user query is embedded the same way, and the database returns the ten nearest documents in milliseconds, something a relational distance scan over millions of rows could not do.
Read the original → en.wikipedia.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.