I am using LIMIT
and OFFSET
in InfluxQL queries to handle pagination.
For example, in a measurement with 3 rows.
> SELECT *::field FROM i2QYtZBVSnuXjLhQhuAV6w;
name: i2QYtZBVSnuXjLhQhuAV6w
time hello
---- -----
2018-02-23T18:00:00Z 1000
2018-02-23T18:30:00Z 1200
2018-02-23T19:00:00Z 990
Supposing I read the rows one by one using LIMIT
and OFFSET
:
> SELECT *::field FROM i2QYtZBVSnuXjLhQhuAV6w LIMIT 1;
name: i2QYtZBVSnuXjLhQhuAV6w
time hello
---- -----
2018-02-23T18:00:00Z 1000
> SELECT *::field FROM i2QYtZBVSnuXjLhQhuAV6w LIMIT 1 OFFSET 1;
name: i2QYtZBVSnuXjLhQhuAV6w
time hello
---- -----
2018-02-23T18:30:00Z 1200
> SELECT *::field FROM i2QYtZBVSnuXjLhQhuAV6w LIMIT 1 OFFSET 2;
name: i2QYtZBVSnuXjLhQhuAV6w
time hello
---- -----
2018-02-23T19:00:00Z 990
Is there a way to know that there is no more data after that without performing an additional query?
EDIT: My use case is generating a "next page token" for a user-facing REST API. I'd like to avoid giving the user a token that will just return an empty row set.