-
Notifications
You must be signed in to change notification settings - Fork 23.5k
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
Retrieve all IDs and latest timestamps for a given stream without going through the all the data #7640
Comments
I checked that it is not available. I wouls do this
|
@yoonghm can you please elaborate? maybe give an example fo what you're trying to do? AFAIU stream "ID" and timestamp is the same thing |
I 100% agree that this would be a useful feature - i.e. being able to use xrange/xrevrange to return, say the last 50 timestamps from a stream (just the timestamps without any of the data attached), to determine if you want to pull all of the data or just specific portions. It's less important if you're storing small data points, but becomes more of an issue if you're storing larger binary data in a stream. Being able to cherry pick data points is a huge advantage of Redis Streams over using standard queues, but it kind of defeats the point if you still have to read all of the data anyways. On a similar note, it would also be useful to be able to query a specific field (key?) from a stream instead of returning the whole stream data. That way, you could store some metadata alongside a larger piece of data and query that more efficiently. Being able to mix and match these two things would be so useful. @guybe7 what do you think? |
@beasteers just making sure we're on the same page... the first feature you're talking about is basically XRANGE which doesn't return the data itself. example:
the second feature is the same as XRANGE, but returns only partial data. example:
did I understand correctly? |
Yep that's the idea! |
@oranagra @itamarhaber WDYT? |
The 1st feature is a good addition, which may also be carried to XREAD. I remember wanting to read only IDs and not the whole message (e.g., imagine a routing process for video frames coming in as a stream [which is what I needed this for]). The 2nd feature is interesting as well and reminds me of #5827. IMO, we shouldn't return "2-0 (empty array)" and just skip these (or maybe give the option to control), but that's nitpicking. More importantly, we need to be extremely clear that this is still a full scan of the range (i.e. non-indexed), which - depending on the stream's size and server load - could block. Lastly, the original feature requested at the top looks like what we called XHASH (#9574), whereas these two new FRs appear somewhat different. |
Seems useful indeed. I'll reopen this issue and add it to the backlog |
I am using Redis 6. Given a stream, are there ways to retrieve
Thanks
The text was updated successfully, but these errors were encountered: