I compare vector and graph databases by the kind of question they answer: graphs reveal how entities are connected, while vectors retrieve what is semantically similar. I also describe a vector retrieval pipeline from offline indexing through online search and grounded answers.
I describe vector retrieval as two pipelines around one index, with the write path focused on throughput and the read path focused on latency.
- I recommend validating and deduplicating ingested PDFs, wiki pages, tickets, and database rows before normalizing, chunking, and adding source, owner, and timestamp metadata.
- I give 300–800 tokens per chunk and 10–20% overlap as rules of thumb for preparing content for vector retrieval.
I describe an embedding model turning each chunk into a dense vector of ~1,536 numbers, with similar meanings positioned close together.
I recommend Same embedding model + dimension for docs and queries so documents and queries are represented in the same vector space.
I describe HNSW as a layered graph searched in log time, not a full scan.
- I describe online retrieval as embedding the query, searching nearby vectors by cosine similarity, applying metadata filters, and returning top-k results.
I recommend Retrieve 20–50, rerank, keep the best 5 to improve selection while fitting the token budget.
I recommend Measure recall and p95 latency at every hop.
I explain that graph databases store nodes, edges and properties, and that direct edge links avoid JOINs at query time.
I describe graph query cost with the statement: Cost grows with the hops you take, not with table size.
In my graph example, Ana’s purchase edge is dated 2026-03-02, and the recommendation is USB-C Dock along the path Ana → Laptop ← Ben → Dock.
I describe vector search as returning top-k chunks ranked by score, and state that The score is the only "why".
- I recommend graph databases for Multi-hop questions, fraud rings, explainable links, and vector databases for Semantic search, RAG over PDFs, wikis and tickets.
I describe GraphRAG as a workflow where vector retrieves the best chunks, you extract entities and links, the graph reasons over the paths.
For a vector retrieval workflow, I describe combining BM25 with vector search, using a cross-encoder to rerank candidates, and removing near-duplicates before returning ranked results or a grounded RAG answer with citations.
Related: rag pipeline design and debugging, ai agent architecture and workflows, ai quality cost and safety