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>
  • Copy
  • Fill window

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>
  • Copy
  • Fill window

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>
  • Copy
  • Fill window

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.

Read more

Now Generally Available

InfluxDB 3 Core and Enterprise

Start fast. Scale faster.

Get the Updates

InfluxDB 3 Core is an open source, high-speed, recent-data engine that collects and processes data in real-time and persists it to local disk or object storage. InfluxDB 3 Enterprise builds on Core’s foundation, adding high availability, read replicas, enhanced security, and data compaction for faster queries and optimized storage. A free tier of InfluxDB 3 Enterprise is available for non-commercial at-home or hobbyist use.

For more information, check out:

InfluxDB Cloud powered by TSM