liveBook · Manning

Vector database

As explained in Grokking Software Architecture

A vector database is a database system optimized for storing, indexing, and querying numerical vector representations.

A vector database stores numerical representations of data so it can find items by semantic similarity, not just matching words. That makes it a potential third data-storage choice alongside SQL and NoSQL for AI features. section 8.0 section 8.2.3

An AI model converts text or images into embeddings: lists of numbers that represent traits or concepts. A query is converted into coordinates too, and the database finds nearby vectors. The closer the vectors, the more similar their meanings are treated as. section 8.2.3

Search by meaning

A keyword search for “Red Shirt” might miss a product labeled “Crimson Top.” A vector search can find it because their meanings are similar. Likewise, the example vectors for “Dog” and “Puppy” are close, while “Car” is far away. section 8.2.3 section 8.2.3

The examples of available options include:

  • Pinecone, a managed vector database. section 8.2.3
  • Weaviate, an open-source option that developers can host themselves. section 8.2.3
  • pgvector, a PostgreSQL plugin that adds vector-database functionality. section 8.2.3
Figure 8.4 Vector Embeddings: The database stores "Meaning" as coordinates. Concepts that are semantically similar live in the same mathematical neighborhood.

The diagram illustrates how semantically similar concepts sit near one another in vector space. section 8.2.3

Choose a vector database when the task depends on finding semantically similar items, such as recommending products bought alongside a tennis racket. That recommendation behavior requires mathematical distance calculations rather than keyword matching. section 8.8.3

How Grokking Software Architecture covers it

How deep it goes
Explains embeddings as numerical coordinates, illustrates nearest-neighbor retrieval, and names database options.
Examples
Uses product-label search, dog-and-puppy similarity, and tennis-racket recommendations as examples.
What you can do after
Evaluate database fit by matching semantic-similarity workloads to vector databases rather than keyword search.
How it connects
Connects vector databases to embeddings, nearest-neighbor search, SQL, and NoSQL.

Also explained in

Compare how 34 books explain vector database →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.