Suggestion: FT.VACUUM
a new command for compacting an existing index
#210
Replies: 2 comments
-
I like this idea! My main concern with your suggestion is around "we lock the index, this time for "WRITE"" which may lead to prolong query unavailability. I think we can avoid this query unavailability with a slight change:
WDYT? |
Beta Was this translation helpful? Give feedback.
-
Why not just implement the ALIAS commands? Once those are in place, then we're done. You just issue FT.CREATE onto a new index and then when it's done issue an ALIAS to swap the two. There's no prohibitions on read/write locking, etc. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
As the current implementation of the HNSWLIB does not support releasing memory, but instead allows to use re-use it, it makes sense to add a new command
FT.VACUUM
(inspired fromsqlite3
vacuum
's command) which re-builds the index, excluding deleted nodes.A rough implementation:
Use cases
The suggested command is expensive, but it is called by the user and the user should be aware of the consequences.
It provides a (IMO) reasonable mitigation for people who are running low on memory (a typical usage for this: a user creates a cron job that runs during low traffic hours to reclaim memory)
Thoughts?
@yairgott @allenss-amazon
Beta Was this translation helpful? Give feedback.
All reactions