danni-m / redis-timeseries

Future development of redis-timeseries is at github.com/RedisLabsModules/redis-timeseries.

Home Page:https://github.com/RedisLabsModules/redis-timeseries

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add TS.RANGE command complexity description

r-alekseev opened this issue · comments

Hello danni-m! Please tell about the time complexity of TS.RANGE in the README.md.

Hi,
TS.RANGE complexity is O(n/m+k*m)
n = number of data points
m = chunk size (data points per chunk)
k = number of data points that are in the requested range

This can be improved in the future by using binary search to find the start of the range, which will make this O(Log(n/m)+k*m), but since m is pretty small, we can neglect it at look at the operation as O(Log(n) + k).
@r-alekseev i hope this answers your question, i'll document it better.
Thanks for the feedback!

Thank you, @danni-m!