pg.ddx.io pgvector/pgvector GitHub issues and pull requests
help / color / mirror / Atom feedFrom: jkatz (@jkatz) <noreply+jkatz@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #678: Iterative index scans
Date: Sun, 29 Sep 2024 18:44:22 +0000
Message-ID: <gh-pgvector-pgvector-678-c2381458610@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-678@github.com>
References: <gh-pgvector-pgvector-678@github.com>
Here are results from using the [VectorDBBench](https://github.com/zilliztech/VectorDBBench) utility with Case 11 (`Performance1536D5M`) - 5MM OpenAI 1536d vectors. This is just a test with the flat vectors, no quantization (that is planned for a follow-up).
Here are the notable settings from the environment:
## Server
- r7gd.16xlarge (64 vCPU, 512GiB RAM)
- DB stored to NVMe, but entire workload is in memory
- PostgreSQL 16.4, Ubuntu 22.04
- Configuration:
- `shared_buffers`: `128GB`
- `work_mem`: `64MB`
- `effective_cache_size`: `256GB`
- (as we're only showing query performance, redacting other parameters)
## pgvector
- Index type: HNSW (`vector_cosine_ops`)
- `m`: `16`
- `ef_construction`: `256`
- `k`: `100` - **this is purposely chosen to see how pgvector behaviors with a larger `k` - I'm also testing the "traditional" `k=10`.
## Results
| version | ef_search | recall | QPS (singe client) | QPS (max) | single client p99 (ms) | Max QPS p99 (ms) |
|---------|-----------|----------|-------------------|-----------|------------------------|------------------|
| 0.7.4 | 80 | 0.783 | 267 | 10,626 | 11.8 | 9.7 |
| 0.8.0 (1a1221f) | 80 | 0.951 | 178 | 6,840 | 17.0 | 13.8 |
| 0.7.4 | 100 | 0.920 | 228 | 9,023 | 13.4 | 11.0 |
| 0.8.0 (1a1221f) | 100 | 0.921 | 257 | 10,378 | 12.7 | 9.2 |
| 0.7.4 | 120 | 0.934 | 217 | 8,273 | 14.6 | 11.2 |
| 0.8.0 (1a1221f) | 120 | 0.934 | 222 | 8,668 | 13.8 | 10.9 |
| 0.7.4 | 155 | 0.950 | 168 | 6,668 | 16.5 | 14.0 |
| 0.8.0 (1a1221f) | 155 | 0.950 | 181 | 6,983 | 16.5 | 13.5 |
| 0.7.4 | 180 | 0.959 | 145 | 5,569 | 19.0 | 17.9 |
| 0.8.0 (1a1221f) | 180 | 0.958 | 167 | 6,540 | 18.5 | 14.6 |
| 0.7.4 | 240 | 0.970 | 114 | 4,398 | 23.1 | 21.9 |
| 0.8.0 (1a1221f) | 240 | 0.970 | 131 | 4,920 | 22.8 | 19.6 |
| 0.7.4 | 350 | 0.981 | 85 | 3,254 | 29.6 | 29.1 |
| 0.8.0 (1a1221f) | 350 | 0.981 | 92 | 3,528 | 29.4 | 27.7 |
| 0.7.4 | 600 | 0.990 | 57 | 2,092 | 44.2 | 46.6 |
| 0.8.0 (1a1221f) | 600 | 0.990 | 59 | 2,233 | 43.4 | 44.4 |
## Results
With streaming mode, there's an interesting recall bump in `1a1221f` when `hnsw.ef_search` < `LIMIT` - per an offlist discussion with Andrew, this is due to the iterative scan working to satisfy the limit. Cool! That said, it comes with a performance impact, but that's likely still better behavior than "not returning enough results" (though that tends to be noticed more when a filter / `WHERE` clause is involved).
Once `hnsw.ef_search` >= `LIMIT`, we see the recall realign, but the streaming branch is showing nontrivial gains in performance (10-15%).
view thread (46+ messages) latest in thread
Message-ID: <gh-pgvector-pgvector-678-c2381458610@github.com>
Permalink: ../gh-pgvector-pgvector-678-c2381458610@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