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 offsetA 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
4Skipping 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
5See LIMIT for the equivalent comma syntax.