---
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-serverless/reference/influxql/limit-and-slimit/
estimated_tokens: 1920
product: InfluxDB Cloud Serverless
version: cloud-serverless
---

# LIMIT and SLIMIT clauses

Use `LIMIT` to limit the number of **rows** returned per InfluxQL group. Use `SLIMIT` to limit the number of [series](/influxdb3/cloud-serverless/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-serverless/reference/influxql/group-by/), the entire result set is considered a single group. If a query [groups data by time](/influxdb3/cloud-serverless/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-serverless/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-serverless/reference/influxql/feature-support/).
