0
0
Redisquery~5 mins

Stream entry IDs in Redis - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a Stream entry ID in Redis Streams?
A Stream entry ID is a unique identifier for each message in a Redis Stream. It consists of two parts: a timestamp in milliseconds and a sequence number, formatted as <millisecondsTime>-<sequenceNumber>.
Click to reveal answer
beginner
How does Redis generate Stream entry IDs if you don't specify one?
Redis automatically generates the ID using the current server time in milliseconds and a sequence number starting at 0 for entries created in the same millisecond.
Click to reveal answer
intermediate
Why does the Stream entry ID have two parts: timestamp and sequence number?
The timestamp ensures ordering by time, and the sequence number handles multiple entries created in the same millisecond, making each ID unique and ordered.
Click to reveal answer
intermediate
What happens if you provide a custom Stream entry ID when adding an entry?
You can specify a custom ID, but it must be greater than the last ID in the stream to keep the order. Otherwise, Redis will return an error.
Click to reveal answer
beginner
Explain the format of a Stream entry ID with an example.
A Stream entry ID looks like '1657891234567-0'. Here, '1657891234567' is the timestamp in milliseconds, and '0' is the sequence number for entries created at that exact millisecond.
Click to reveal answer
What are the two parts of a Redis Stream entry ID?
ATimestamp and sequence number
BUser ID and timestamp
CSequence number and user ID
DTimestamp and message content
If multiple entries are added in the same millisecond, how does Redis ensure unique IDs?
ABy rejecting entries added in the same millisecond
BBy changing the timestamp format
CBy using random numbers
DBy adding a sequence number after the timestamp
What happens if you try to add a stream entry with an ID smaller than the last entry's ID?
ARedis accepts it without error
BRedis returns an error
CRedis automatically updates the ID
DRedis deletes the last entry
Which part of the Stream entry ID helps maintain the order of messages?
ATimestamp
BSequence number
CMessage content
DUser ID
What is the format of a Redis Stream entry ID?
A<sequence>-<timestamp>
B<user>-<timestamp>
C<timestamp>-<sequence>
D<timestamp>_<sequence>
Describe how Redis Stream entry IDs are structured and why they are designed that way.
Think about how Redis keeps messages unique and in order.
You got /4 concepts.
    Explain what happens when you add a stream entry with a custom ID and what rules it must follow.
    Consider the importance of ordering in streams.
    You got /3 concepts.