Documentation

LIMIT and SLIMIT clauses

Use LIMIT and SLIMIT to limit the number of points and series returned per query.

LIMIT clause

LIMIT <N> returns the first N points from the specified measurement.

Syntax

SELECT_clause FROM_clause [WHERE_clause] [GROUP_BY_clause] [ORDER_BY_clause] LIMIT <N>

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.

Examples

Limit the number of points returned

Limit the number of points returned and include a GROUP BY clause

SLIMIT clause

SLIMIT <N> returns every point from N series in the specified measurement.

Syntax

SELECT_clause FROM_clause [WHERE_clause] GROUP BY *[,time(<time_interval>)] [ORDER_BY_clause] SLIMIT <N>

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

Limit the number of series returned and include a GROUP BY time() clause

Use LIMIT and SLIMIT together

LIMIT <N> followed by SLIMIT <2> returns the first N1 points from N2 series in the specified measurement.

Syntax

SELECT_clause FROM_clause [WHERE_clause] GROUP BY *[,time(<time_interval>)] [ORDER_BY_clause] LIMIT <N1> SLIMIT <N2>

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.

Examples

Limit the number of points and series returned

Limit the number of points and series returned and include a GROUP BY time() clause


Was this page helpful?

Thank you for your feedback!


The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Flux is going into maintenance mode and will not be supported in InfluxDB 3.0. This was a decision based on the broad demand for SQL and the continued growth and adoption of InfluxQL. We are continuing to support Flux for users in 1.x and 2.x so you can continue using it with no changes to your code. If you are interested in transitioning to InfluxDB 3.0 and want to future-proof your code, we suggest using InfluxQL.

For information about the future of Flux, see the following: