Memory Presets
Mem0 pgvector Hybrid PostgreSQL 16 Stack Preset
Run Mem0 inside an existing PostgreSQL 16 database using pgvector HNSW and halfvec fp16 when transactional SQL joins outweigh Qdrant scale.
halfvec 2x RAM Cut · ACID SQL Joins · maintenance_work_mem=2 GB
Operational Simplicity vs Pure Vector Throughput
Teams already operating PostgreSQL 16 for user billing and RBAC often prefer pgvector below 1-2 million memories to avoid managing a second stateful engine. Using halfvec(1536) halves memory consumption with negligible recall loss.
Preventing HNSW Build OOM Spikes
Building a pgvector HNSW index requires roughly 1.35x the steady-state index size in maintenance_work_mem. Provision swap or temporarily boost maintenance_work_mem on a dedicated 16 GB Vultr HF node during bulk migrations.
Measured Thresholds & Vector Stack Parameters
| Parameter / Setting | Recommended Value | Operational Reason |
|---|---|---|
| Vector Column Type | halfvec(1536) instead of vector(1536) | Halves PostgreSQL index and heap footprint from 6 KB to 3 KB |
| shared_buffers | 25% - 30% of Host RAM | Caches hot HNSW index pages and relational user metadata |
| maintenance_work_mem | 1 GB - 4 GB during CREATE INDEX | Stops HNSW graph builds from spilling to slow temp files |
| Practical Ceiling | <= 2M vectors per single primary | Beyond 2M facts, Qdrant int8 delivers superior RAM efficiency |