pgvector 와 함께 ship 되는 두 인덱스
- HNSW (Hierarchical Navigable Small World) — 그래프 기반 ANN. 높은 recall, 느린 build, incremental insert 지원. 2026년 default.
- IVFFlat (Inverted File with Flat compression) — 파티션 기반. 빠른 build, 낮은 recall, 데이터 늘면 주기적 rebuild 필요.
파라미터 고르기
HNSW 의 두 knob 은 m (그래프 degree, default 16) + ef_construction (build effort, default 64). query 에는 SET hnsw.ef_search = 40 으로 runtime 에 recall vs latency tradeoff. IVFFlat 은 create 시점 lists + query 시점 ivfflat.probes 가 같은 역할.
여기서 'recall' 이 진짜 뭘 의미해
ANN 인덱스는 approximate. Recall 은 인덱스가 실제로 반환하는 진짜 top-k 결과의 비율. HNSW 가 default 셋팅으로 보통 0.95–0.99; 낮은 probes 의 IVFFlat 은 0.7 까지 떨어질 수 있어. 숫자 믿기 전에 항상 held-out query set 으로 exact scan 대비 recall 측정.