Container & RAM Tuning
RAG Chunk Size, Overlap & Ingestion Batch Memory Impact
Understand how reducing chunk size from 1,000 tokens to 400 tokens multiplies HNSW vector count 2.5x and inflates pgvector RAM.
2.5x Vector Bloat at 400 Tokens · 4,000 Max Seg Len
Chunk Granularity Directly Drives RAM
Every chunk generates a 1536-float (6 KB raw) embedding plus HNSW graph pointers (~8.5 KB overhead). Cutting chunk size in half doubles total vector count and memory consumption even for the exact same source PDF library.
Parent-Child Retrieval Tradeoffs
Use parent-child indexing selectively on dense manuals rather than every knowledge base so pgvector HNSW graphs stay comfortably inside 8-16 GB KVM nodes.
Measured Thresholds & Container Limits
| Chunk Token Target | Chunks per 10M Tokens | pgvector HNSW RAM |
|---|---|---|
| 1,000 tokens (10% overlap) | ~11,000 vectors | ~160 MB index |
| 500 tokens (15% overlap) | ~23,500 vectors | ~340 MB index |
| 250 tokens (20% overlap) | ~50,000 vectors | ~725 MB index |