> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cockroachlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Limit Query Results

The `LIMIT` and `OFFSET` clauses restrict the operation of:

* A [selection query](/docs/stable/selection-queries.md), including when it occurs as part of [`INSERT`](/docs/stable/insert) or [`UPSERT`](/docs/stable/upsert).
* [`UPDATE`](/docs/stable/update) and [`DELETE`](/docs/stable/delete) statements.

`OFFSET` instructs the operation to skip a specified number of rows. It is often used in conjunction with `LIMIT` to "paginate" through retrieved rows.

> [!CAUTION]
>
> Using `LIMIT`/`OFFSET` to implement pagination can be very slow for large tables.  We recommend using [keyset pagination](/docs/stable/pagination.md) instead.

## Syntax

### LIMIT

```
LIMIT { <limit_value> | ALL }
```

For PostgreSQL compatibility, CockroachDB also supports `FETCH FIRST limit_value ROWS ONLY` and `FETCH NEXT limit_value ROWS ONLY` as aliases for `LIMIT`. If `limit_value` is omitted, then one row is fetched.

### OFFSET

```
OFFSET <offset_value> [ ROW | ROWS ]
```

## Examples

For example uses with `SELECT`, see [Limit Row Count](/docs/stable/selection-queries.md#limit-row-count).

## See also

* [`DELETE`](/docs/stable/delete)
* [`UPDATE`](/docs/stable/delete)
* [`INSERT`](/docs/stable/insert)
* [`UPSERT`](/docs/stable/upsert)
* [Selection Queries](/docs/stable/selection-queries.md)
