Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

range delete #9

Closed
rvagg opened this issue Feb 22, 2013 · 8 comments
Closed

range delete #9

rvagg opened this issue Feb 22, 2013 · 8 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@rvagg
Copy link
Member

rvagg commented Feb 22, 2013

dupe of Level/levelup#23, needs to be done mostly here rather than there.

@Raynos
Copy link
Member

Raynos commented Feb 22, 2013

@rvagg
Copy link
Member Author

rvagg commented Feb 22, 2013

yeah, sure, but that's a very inefficient mechanism since for each key you're crossing the thread boundary twice via libuv (once for the iterator->JS 'data' and then once for the JS del()->leveldb) and you're also doing a memcpy() of the key both ways as well. The reason I think this should be in core is that it can be done on the same thread, directly with an iterator, no memcpy() and no JS involved, very efficient. This is one of those cases where it makes a lot of sense to do it in core because the efficiency gain is huge.

@dominictarr
Copy link
Contributor

So, what % improvement will a benchmark show?

@dominictarr dominictarr mentioned this issue Feb 24, 2013
@dominictarr
Copy link
Contributor

if this took iterator arguments, like limit: 1 you could use it to delete the last or first item in a range,
and use it to produce things like top 100 lists.

@mbrevoort
Copy link

Could really benefit from this. Bumping into a case where I am managing capped timeseries and my deletes can't keep up with my writes.

@rvagg
Copy link
Member Author

rvagg commented May 12, 2014

Marking as "help wanted", a good project for someone wanting to get their hands dirty. I don't think this would ever be exposed at the LevelUP layer but features like this that are specific to back-ends should be exposed in the LevelDOWN layer so you can access them if you need them. level-range-delete could even detect the presence of a db.db.rangeDelete() function and use that if it exists.

@dominictarr
Copy link
Contributor

Oh, while this has surfaced again,
I should mention something that I've realized recently. deletes are actually writes.
You have to write a record to the database that says "please forget X"

So if you are only deleting something to save space, maybe an idea would be to just not delete it? eventually the deletes should be compacted away, but short/mid term they are extra records.

Having a range-delete is really encouraging adding a lot of extra records to a database,
but telling the user they are being removed.

@vweevers
Copy link
Member

Closing in favor of #680.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants