Vector Databases Exercises

Fill in the blanks to test your knowledge.

1

Name the search method used in vector databases

// Finds vectors most similar to a query

// Called search

2

Complete the ChromaDB client creation

import chromadb
client = chromadb.(path="./db")
3

Create or retrieve a ChromaDB collection

collection = client.get_or_create_collection(name=)

4

Name the PostgreSQL extension for vector storage

-- Enable vector support in PostgreSQL

CREATE EXTENSION IF NOT EXISTS ;

5

Use pgvector cosine distance operator in SQL

SELECT content

FROM documents

ORDER BY embedding $1::vector

LIMIT 5;

6

Name the popular ANN algorithm used by pgvector and Qdrant

-- Creates a graph-based ANN index

CREATE INDEX USING (embedding vector_cosine_ops);

7

Name the parameter that limits results in vector search

results = index.query(vector=query_vec, =10)

8

Identify what ANN stands for

// Trades perfect accuracy for speed in large datasets

// ANN = Nearest Neighbor