N specifies the number of points to return from the specified measurement . If N is greater than the number of points in a measurement, InfluxDB returns all points from the measurement.
IMPORTANT: The LIMIT clause must appear in the order outlined in the syntax above.
This query uses the InfluxQL MEAN() function and a GROUP BY clause to calculate the average water_level for each tag and for each 12-minute interval in the queried time range. LIMIT 2 requests the two oldest 12-minute averages (determined by timestamp).
Note that without LIMIT 2, the query would return four points per series; one for each 12-minute interval in the queried time range.
N specifies the number of series to return from the specified measurement. If N is greater than the number of series in a measurement, InfluxDB returns all series from that measurement.
SLIMIT queries must include GROUP BY *. Note that the SLIMIT clause must appear in the order outlined in the syntax above.
Examples
Limit the number of series returned
SELECT"water_level"FROM"h2o_feet"GROUPBY*SLIMIT1
Output:
name: h2o_feet
tags: location=coyote_creek
time
water_level
2019-08-17T00:00:00Z
8.1200000000
2019-08-17T00:06:00Z
8.0050000000
2019-08-17T00:12:00Z
7.8870000000
2019-08-17T00:18:00Z
7.7620000000
2019-08-17T00:24:00Z
7.6350000000
2019-08-17T00:30:00Z
7.5000000000
2019-08-17T00:36:00Z
7.3720000000
The results above include only the first few rows, as the data set is quite large. The query returns all water_levelpoints from one of the series associated with the h2o_feetmeasurement.
Limit the number of series returned and include a GROUP BY time() clause
The query uses the InfluxQL MEAN() function
and a time interval in the GROUP BY clause
to calculate the average water_level for each 12-minute
interval in the queried time range.
SLIMIT 1 requests a single series associated with the h2o_feet measurement.
Note that without SLIMIT 1, the query would return results for the two series
associated with the h2o_feet measurement: location=coyote_creek and
location=santa_monica.
Use LIMIT and SLIMIT together
LIMIT <N> followed by SLIMIT <2> returns the first N1points from N2 series in the specified measurement.
N1 specifies the number of points to return per measurement. If N1 is greater than the number of points in a measurement, InfluxDB returns all points from that measurement.
N2 specifies the number of series to return from the specified measurement. If N2 is greater than the number of series in a measurement, InfluxDB returns all series from that measurement.
SLIMIT queries must include GROUP BY *. Note that the SLIMIT clause must appear in the order outlined in the syntax above.
The query uses the InfluxQL function MEAN() and a time interval in the GROUP BY clause to calculate the average water_level for each 12-minute interval in the queried time range. LIMIT 2 requests the two oldest 12-minute averages (determined by
timestamp) and SLIMIT 1 requests a single series associated with the h2o_feet measurement.
Note that without LIMIT 2 SLIMIT 1, the query would return four points for each of the two series associated with the h2o_feet measurement.
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community!
We welcome and encourage your feedback and bug reports for InfluxDB and this documentation.
To find support, use the following resources:
InfluxDB v3 enhancements and InfluxDB Clustered is now generally available
New capabilities, including faster query performance and management
tooling advance the InfluxDB v3 product line.
InfluxDB Clustered is now generally available.
InfluxDB v3 performance and features
The InfluxDB v3 product line has seen significant enhancements in query
performance and has made new management tooling available. These enhancements
include an operational dashboard to monitor the health of your InfluxDB cluster,
single sign-on (SSO) support in InfluxDB Cloud Dedicated, and new management
APIs for tokens and databases.
You are currently viewing documentation specific to InfluxDB Cloud
powered by the TSM storage engine, which
offers different functionality than InfluxDB Cloud
Serverless
powered by the v3 storage engine.