Database / ChromaDB Interview Questions
How does ChromaDB compare to FAISS, and when should you choose one over the other?
FAISS (Facebook AI Similarity Search) and ChromaDB both store and search embedding vectors, but they are designed for very different use cases. FAISS is a low-level library optimised for raw performance; ChromaDB is a higher-level database designed for developer ergonomics and full-stack AI applications.
| Feature | ChromaDB | FAISS |
|---|---|---|
| Type | Vector database (full-stack) | Vector index library (low-level) |
| Storage | Persistent SQLite + HNSW files | In-memory or flat files (manual) |
| Metadata | Built-in key-value filtering | No metadata — must manage separately |
| Documents | Stores original text alongside vectors | Stores vectors only — text management is manual |
| Persistence | Built-in PersistentClient | Manual save/load with faiss.write_index() |
| CRUD | add, get, update, delete, upsert | Add only — no update/delete without rebuilding |
| API | High-level Python + REST | Low-level Python/C++ bindings |
| Performance | Good for <10M docs | Excellent for 10M+ docs (GPU-accelerated) |
| Embedding function | Built-in (auto-embed text) | You must manage embeddings yourself |
| Best for | RAG apps, prototyping, small-medium scale | High-throughput ML systems, research, scale |
# FAISS — lower level, manage everything manually
import faiss
import numpy as np
# Build index manually
dim = 384
index = faiss.IndexFlatIP(dim) # inner product
vectors = np.random.rand(1000, dim).astype("float32")
faiss.normalize_L2(vectors)
index.add(vectors) # add vectors
D, I = index.search(query_vec, k=5) # search
faiss.write_index(index, "index.faiss") # save manually
# ChromaDB — higher level, text in, results out
import chromadb
client = chromadb.Client()
col = client.create_collection("demo")
col.add(documents=["text one", "text two"], ids=["1","2"])
results = col.query(query_texts=["similar text"], n_results=2)
# Embeddings, persistence, metadata all handled automatically
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
