Documentation

LIMIT and SLIMIT clauses

This page documents an earlier version of InfluxDB. InfluxDB v2.7 is the latest stable version. View this page in the v2.7 documentation.

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!


Set your InfluxDB URL

Introducing InfluxDB 3.0

The new core of InfluxDB built with Rust and Apache Arrow. Available today in InfluxDB Cloud Dedicated.

Learn more

State of the InfluxDB Cloud Serverless documentation

The new documentation for InfluxDB Cloud Serverless is a work in progress. We are adding new information and content almost daily. Thank you for your patience!

If there is specific information you’re looking for, please submit a documentation issue.