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

Feature Request - Count(start, limit) and Delete(start, limit) #119

Closed
cmumford opened this issue Sep 9, 2014 · 3 comments
Closed

Feature Request - Count(start, limit) and Delete(start, limit) #119

cmumford opened this issue Sep 9, 2014 · 3 comments
Assignees

Comments

@cmumford
Copy link
Contributor

cmumford commented Sep 9, 2014

Original issue 113 created by sawloo on 2012-09-04T22:18:53.000Z:

Count(start, limit)

seems that some people also want a count/size method without calling the iterator to loop thru the entire set just to count the number of records. So, would be great if there is a method like "Count(start, limit)" or "Count(range)" to count the number of records which fall inside the range [start, limit).

Delete(start, limit)

A fast Delete methods which delete a range of keys [start, limit) would be nice. I guess this can be optimized inside levelDB to do this instead of having my program looping and delete one by one.

@cmumford
Copy link
Contributor Author

cmumford commented Sep 9, 2014

Comment #1 originally posted by alexkarpenko on 2012-09-15T23:35:26.000Z:

Similarly, it'd be great if we could get the size of an entry, without also fetching the value from disk.

@cmumford cmumford self-assigned this Sep 9, 2014
@cmumford
Copy link
Contributor Author

cmumford commented Sep 9, 2014

Comment #2 originally posted by sanjay@google.com on 2012-09-18T17:18:47.000Z:

There is no way to implement Count more efficiently inside leveldb than outside.

"Delete range" could theoretically be implemented more efficiently inside leveldb, but it would be very complicated or would interact badly with snapshots. So it won't happen any time soon.

@cmumford
Copy link
Contributor Author

cmumford commented Sep 9, 2014

Comment #3 originally posted by earonesty on 2014-07-10T18:44:29.000Z:

If a fast count is important, you can keep track of the count as you write entries, and write it out as it's own special entry.

# pseudo 
if (!get(k)) {
   put(k,v)
   c=get("*cnt");
   ++c;
   put("*cnt",v)
} else {
   put(k,v)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant