A stream id is a timestamp, and ranges over it are free

Redis stream ids are a millisecond timestamp plus a sequence number, which means a time range is a key range and needs no secondary index.

> XADD orders '*' order_id 91204
"1594819200123-0"

# everything in a one-hour window, by id
> XRANGE orders 1594819200000 1594822800000

# and the last hundred, which is O(1) from the end
> XREVRANGE orders + - COUNT 100

Constructing an id from a timestamp to seek into the stream is the trick this enables, and it makes a replay from a known point trivial. The sequence number is what disambiguates entries added in the same millisecond, so ids are unique and totally ordered. Supplying an explicit id rather than * is allowed and must be monotonically increasing, which is how a producer can make ids meaningful — and how it can break the stream permanently.