-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support sorting by time desc #3986
Conversation
Order by time asc and desc are the only supported order by options currently. Tags, fields, or multiple order by fields will return a parse error.
Cool. Are all the |
Looks like I forgot to switch those over to the enum. Will fix. |
Should we expect a query performance hit for normal time-ascending queries? You should probably check it, if you haven't already. |
|
||
// order by time desc | ||
&Query{ | ||
name: "order by time desc", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe aggregate order by time desc
?
Very nice. Great test coverage. +1 |
@otoolep I'll check. Ascending should perform as before for both raw and aggregate queries. Desc raw w/ |
@otoolep Performance for raw and aggregate queries for asc and desc is the same from master to my branch using 10M points. Desc doesn't seem to have much overhead either which is good. |
This PR adds support for sorting results by time in descending order. Two syntaxes are allowed:
This allows queries to find the most recent value instead of having to query the whole data set to see the last value. Currently only sorting by time is allowed on raw and aggregate queries. If there are multiple sort fields, a parse error will be returned. Similarly, if a sort field other than
time
is specified, a parse error is returned.Fixes #2022