An optional time, or head/tail range can be given to select only a part of the series data. If no range is provided SiriDB returns all the data available. As a range we can use before, after, between .. and .., head or tail.
after you basically set a start time, with
before an end time
and when using
between .. and .. you set both a start and end time.
Points that have the exact start time are included in the result, points
with the exact end time are excluded from the result.
The allowed formats for time ranges are:
s(second). For example,
2wis equal to two weeks.
It’s safe to use now multiple times in a query. SiriDB only calculates now one time while processing a query. This way you can be sure that now has the same value.
It is also possible to ask for the first or last X points from series by using
tail respectively followed by an integer value.
# Select all points from "series-001" in the last 24h select * from "series-001" after now - 1d # Select all points from "series-001" today select * from "series-001" between now - (now % 1d) and now - (now % 1d) + 1d # Select all points from "series-001" before November, 2015 select * from "series-001" before "2015-11" # Select the last 10 points from "series-001" select * from "series-001" tail 10 # Select the first 5 points from "series-001" select * from "series-001" head 5