Skip to main content
The LIMIT and OFFSET clauses restrict the operation of:
  • A , including when it occurs as part of or .
  • and 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.
Using LIMIT/OFFSET to implement pagination can be very slow for large tables. We recommend using instead.

Syntax

LIMIT

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

Examples

For example uses with SELECT, see .

See also