pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
[pgvector/pgvector] PR #422: Add FAQ HNSW vs IVFFlat?
5+ messages / 4 participants
[nested] [flat]

* [pgvector/pgvector] PR #422: Add FAQ HNSW vs IVFFlat?
@ 2024-01-20 17:19  "xzilla (@xzilla)" <noreply+xzilla@github.com>
  0 siblings, 0 replies; 5+ messages in thread

From: xzilla (@xzilla) @ 2024-01-20 17:19 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Summarize the trade-offs at play when choosing between HNSW or IVFFlat indexes.

Inspired by recent PR #404 by @danthedaniel. 

inline patch 1: README.md (+12/-0 lines) download inline-1.patchdiff --git a/README.md b/README.md index c84436236..1fd1ac4e7 100644 --- a/README.md +++ b/README.md @@ -499,6 +499,18 @@ No, but like other index types, you’ll likely see better performance if they d SELECT pg_size_pretty(pg_relation_size('index_name')); ``` +#### Should I use HNSW or IVFFlat indexes? + +The ideal index type depends on specific trade-offs needed for any given workload. While a comprehensive analysis of all possible trade-offs is outside the scope of this discussion, the following provides a summary of typical (but not definitive) expectations. Of course we recommend benchmarking your specific workload for optimal performance. + +Feature | HNSW | IVFFlat +--- | --- | --- +Query speed | Faster | Slower +Recall | Higher | Lower +Index building | Slower | Faster +Memory usage | Higher | Lower +Incremental data changes | Handles well | Less optimal, may need re-building + ## Troubleshooting #### Why isn’t a query using an index?
^ permalink raw [nested|flat] 5+ messages in thread

* Re: [pgvector/pgvector] PR #422: Add FAQ HNSW vs IVFFlat?
@ 2024-09-14 20:48  "gwenshap (@gwenshap)" <noreply+gwenshap@github.com>
  3 siblings, 0 replies; 5+ messages in thread

From: gwenshap (@gwenshap) @ 2024-09-14 20:48 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

This looks good and summarizes well what I've found in other sources. Merging it will be helpful.

^ permalink  raw  [nested|flat] 5+ messages in thread

* Re: [pgvector/pgvector] PR #422: Add FAQ HNSW vs IVFFlat?
@ 2025-01-28 14:48  "michaelbautin (@michaelbautin)" <noreply+michaelbautin@github.com>
  3 siblings, 0 replies; 5+ messages in thread

From: michaelbautin (@michaelbautin) @ 2025-01-28 14:48 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

I also think it would be useful to merge this.

^ permalink  raw  [nested|flat] 5+ messages in thread

* Re: [pgvector/pgvector] PR #422: Add FAQ HNSW vs IVFFlat?
@ 2025-04-10 20:29  "ankane (@ankane)" <noreply+ankane@github.com>
  3 siblings, 0 replies; 5+ messages in thread

From: ankane (@ankane) @ 2025-04-10 20:29 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Hi @xzilla, thanks for the PR, and sorry for the delay. This difference is explained in the intro to each index type, so I don't think a separate section is needed right now.

^ permalink  raw  [nested|flat] 5+ messages in thread

* Re: [pgvector/pgvector] PR #422: Add FAQ HNSW vs IVFFlat?
@ 2025-04-10 20:29  "ankane (@ankane)" <noreply+ankane@github.com>
  3 siblings, 0 replies; 5+ messages in thread

From: ankane (@ankane) @ 2025-04-10 20:29 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

@ankane closed this.

^ permalink  raw  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2025-04-10 20:29 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-01-20 17:19 [pgvector/pgvector] PR #422: Add FAQ HNSW vs IVFFlat? "xzilla (@xzilla)" <noreply+xzilla@github.com>
2024-09-14 20:48 ` "gwenshap (@gwenshap)" <noreply+gwenshap@github.com>
2025-01-28 14:48 ` "michaelbautin (@michaelbautin)" <noreply+michaelbautin@github.com>
2025-04-10 20:29 ` "ankane (@ankane)" <noreply+ankane@github.com>
2025-04-10 20:29 ` "ankane (@ankane)" <noreply+ankane@github.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox