Comments (13)
Hi @williamhakim10, autovacuum_vacuum_cost_limit
and autovacuum_vacuum_cost_delay
control the vacuum speed (docs). You can set these on individual tables if needed.
Parallel vacuum isn't currently supported, but would be nice to add at some point (added to #27).
from pgvector.
@williamhakim10 Curious -- do you frequently updated rows and/or vectors in the table where vacuum was stuck?
from pgvector.
Hi @williamhakim10,
autovacuum_vacuum_cost_limit
andautovacuum_vacuum_cost_delay
control the vacuum speed (docs). You can set these on individual tables if needed.Parallel vacuum isn't currently supported, but would be nice to add at some point (added to #27).
It feels like this shouldn't matter because I'm manually triggering the vacuum? Unless I misunderstand what these settings do.
@jkatz there would have been only an extremely small number of writes to that table while vacuum was happening, and no updates or deletes as far as I know.
Edit: it's possible there might be a few updates as well, because the insert query we run has an ON CONFLICT ... DO UPDATE clause. But it certainly wouldn't be a large number relative to the size of the table.
from pgvector.
My bad, thought you were talking about autovacuum for some reason.
Vacuum should max out a single CPU. Is that what you're seeing?
In general, vacuuming will be slower than building the index, since the index build can happen in-memory and then write to disk, while vacuuming needs to persist changes to disk for every tuple (which for live tuples, requires updating many pages).
from pgvector.
Also, just looked into parallel vacuuming, and it looks like it only supports a single worker per index (so won't really help here).
from pgvector.
I don't believe Cloud SQL allows you to break out CPU utilization per-core, but generally yes we're seeing total CPU utilization consistent with one core being maxed out over the many hours we attempted to vacuum.
FWIW, rebuilding the index (concurrently) took about 20 minutes after setting maintenance_work_mem
to 35GB, on 0.5.2 (so no parallel index builds).
from pgvector.
Unfortunately, the time to vacuum will likely be closer to the time to build the index with a very small value of maintenance_work_mem
(where the build happens mostly on-disk instead of in-memory, which is significantly slower).
Going back to your original question, I'm not sure there's anything you can do to speed it up right now.
from pgvector.
OK cool, this is good to know. Perhaps this might merit a comment in the README; feels like other folks may unexpectedly encounter this because the size of the HNSW indices can get pretty large without that many vectors, such that large deletes may lead to a situation in which autovacuum can't complete (and even manual vacuum can't run in a reasonable amount of time) leading to unexpected drops in recall? Happy to propose something in a PR if you think it's valuable?
from pgvector.
Spoke too soon. It looks like rebuilding the index with REINDEX INDEX CONCURRENTLY
before vacuuming will make it much faster (since it can rebuild in-memory with maintenance_work_mem
and parallel workers when available).
REINDEX INDEX CONCURRENTLY index_name;
VACUUM table_name;
Will add a note to the readme.
from pgvector.
Awesome. Appreciate you guys walking this through with me!
from pgvector.
Thanks for reporting!
from pgvector.
We are pretty aggressive in the RepairGraph phase, to add replacement edges for the removed ones, to keep the index in good order. I'm not sure that's a good tradeoff. It would probably be better to more lazy. For example, only call HnswFindElementNeighbors if more than 10% of an element's neighbors have been deleted. Otherwise just remove the deleted neighbors and leave some empty slots in it.
from pgvector.
It's an interesting idea. Would need to understand the impact on recall and vacuum speed to have a better idea of if it's (subjectively) worth the trade-off.
from pgvector.
Related Issues (20)
- HNSW Indexing and Filtering HOT 2
- A question about building index in background. HOT 1
- Installation instructions unclear HOT 1
- Large vector data type will cause performance decline? HOT 1
- A question regard table_open() in background worker when building index HOT 3
- jVector Implementation
- Type Error when working with Langchain (Missing Positional Argument: evalue) HOT 1
- pgvector still use row-based storage instead of columnar storage ? HOT 1
- Can't get the query planner to use HNSW index HOT 3
- 【search failed】 2000w、768dim, data search failed HOT 1
- ERROR: index row size 6160 exceeds btree version 4 maximum 2704 for index HOT 3
- Make difficulties HOT 2
- Table Insert Performance with HNSW Index HOT 3
- Comparison with high-precision data HOT 2
- Weight in the filters HOT 5
- can't make pgvector HOT 1
- src\bitvec.c(43): warning C4141: 'dllexport': used more than once HOT 6
- Porting indexes from pinecone to pgvector HOT 1
- Error when creating a halfvec_ip_ops index HOT 3
- Compiling on a mac (Intel)- clang: error: unsupported argument 'native' to option '-march=' HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pgvector.