Skip to content

OFFSET ​

OFFSET skips a number of rows before LIMIT returns the requested page. It is used together with LIMIT; a standalone OFFSET clause is not supported.

Syntax ​

text
LIMIT count OFFSET offset

A negative offset is treated as zero. Use LIMIT -1 OFFSET offset to skip rows without imposing a SQL row count limit.

Include an ORDER BY whose keys break ties. Without a defined order, the rows skipped by an offset are unspecified. Concurrent changes to the selected data can also shift page boundaries between separate queries.

Examples ​

Reading the second page ​

With two rows per page, skip the first two rows:

sql
SELECT generate_series AS id
FROM generate_series(1, 5)
ORDER BY generate_series
LIMIT 2 OFFSET 2
FORMAT csv;
text
3
4

Skipping rows without a count limit ​

sql
SELECT generate_series AS id
FROM generate_series(1, 5)
ORDER BY generate_series
LIMIT -1 OFFSET 3
FORMAT csv;
text
4
5

See LIMIT for the equivalent comma syntax.