---
title: LIMIT and SLIMIT clauses
description: Use LIMIT to limit the number of rows returned per InfluxQL group. Use SLIMIT to limit the number of series returned in query results.
url: https://docs.influxdata.com/influxdb3/cloud-dedicated/reference/influxql/limit-and-slimit/
estimated_tokens: 889
publisher: InfluxData
canonical: https://docs.influxdata.com/influxdb3/cloud-dedicated/reference/influxql/limit-and-slimit/
date: '2025-01-13T07:21:11-07:00'
lastmod: '2025-01-13T07:21:11-07:00'
---

Use `LIMIT` to limit the number of **rows** returned per InfluxQL group.
Use `SLIMIT` to limit the number of [series](/influxdb3/cloud-dedicated/reference/glossary/#series)returned in query results.

* [LIMIT clause](#limit-clause)
  * [Syntax](#limit-syntax)
  * [Examples](#limit-examples)

* [SLIMIT clause](#slimit-clause)

## LIMIT clause

The `LIMIT` clause limits the number of rows to return from each InfluxQL group.
If the query doesn’t include a [`GROUP BY` clause](/influxdb3/cloud-dedicated/reference/influxql/group-by/),
the entire result set is considered a single group.
If a query [groups data by time](/influxdb3/cloud-dedicated/reference/influxql/group-by/#group-by-time),
limits are applied after aggregate and selector operations are applied to each
time window.

### Syntax

```sql
SELECT_clause FROM_clause [WHERE_clause] [GROUP_BY_clause] [ORDER_BY_clause] LIMIT N
```

#### Arguments

* **N**: Maximum number of points to return from each InfluxQL group.
  If `N` is greater than the number of points in a group,
  all points from the group are returned.

### Examples

The following examples use the[Home sensor sample data](/influxdb3/cloud-dedicated/reference/sample-data/#home-sensor-data).

[](#limit-the-number-of-rows-returned)

Limit the number of rows returned

```sql
SELECT * FROM home LIMIT 3
```

Name: home

|        time        |co |hum |   room    |temp|
|--------------------|---|----|-----------|----|
|2022-01-01T08:00:00Z| 0 |35.9|  Kitchen  | 21 |
|2022-01-01T08:00:00Z| 0 |35.9|Living Room|21.1|
|2022-01-01T09:00:00Z| 0 |36.2|  Kitchen  | 23 |

[](#limit-the-number-of-rows-returned-from-each-influxql-group)

Limit the number of rows returned from each InfluxQL group

```sql
SELECT
  MEAN(*)
FROM home
GROUP BY
  time(2h),
  room
LIMIT 3
```

name: home  
tags: room=Kitchen

|        time        |mean\_co|mean\_hum|    mean\_temp    |
|--------------------|--------|---------|------------------|
|2022-01-01T08:00:00Z|   0    |  36.05  |        22        |
|2022-01-01T10:00:00Z|   0    |  36.05  |22.549999999999997|
|2022-01-01T12:00:00Z|  0.5   |  36.25  |      22.65       |

name: home  
tags: room=Living Room

|        time        |mean\_co|mean\_hum|    mean\_temp    |
|--------------------|--------|---------|------------------|
|2022-01-01T08:00:00Z|   0    |  35.9   |      21.25       |
|2022-01-01T10:00:00Z|   0    |   36    |        22        |
|2022-01-01T12:00:00Z|   0    |  35.95  |22.299999999999997|

## SLIMIT clause

InfluxQL is being rearchitected to work with the InfluxDB 3 storage engine.
This process is ongoing and some InfluxQL features, such as `SLIMIT` are still
being implemented. For more information, see[InfluxQL feature support](/influxdb3/cloud-dedicated/reference/influxql/feature-support/).
| time | co | hum | room | temp |
| --- | --- | --- | --- | --- |
| time | co | hum | room | temp |
| 2022-01-01T08:00:00Z | 0 | 35.9 | Kitchen | 21 |
| 2022-01-01T08:00:00Z | 0 | 35.9 | Living Room | 21.1 |
| 2022-01-01T09:00:00Z | 0 | 36.2 | Kitchen | 23 |

| time | mean_co | mean_hum | mean_temp |
| --- | --- | --- | --- |
| time | mean_co | mean_hum | mean_temp |
| 2022-01-01T08:00:00Z | 0 | 36.05 | 22 |
| 2022-01-01T10:00:00Z | 0 | 36.05 | 22.549999999999997 |
| 2022-01-01T12:00:00Z | 0.5 | 36.25 | 22.65 |

| time | mean_co | mean_hum | mean_temp |
| --- | --- | --- | --- |
| time | mean_co | mean_hum | mean_temp |
| 2022-01-01T08:00:00Z | 0 | 35.9 | 21.25 |
| 2022-01-01T10:00:00Z | 0 | 36 | 22 |
| 2022-01-01T12:00:00Z | 0 | 35.95 | 22.299999999999997 |
