What is the difference between LIMIT and OFFSET in SOQL, and what is the maximum value of OFFSET (2,000)?
Answer
LIMIT n caps the number of rows returned. OFFSET n skips the first n rows, useful for pagination (LIMIT 20 OFFSET 40 = page 3).
The maximum OFFSET is 2,000. For deeper pagination use keyset pagination (WHERE Id > :lastId ORDER BY Id LIMIT 200) or queryMore / Database.getQueryLocator.
soql
SELECT Id, Name FROM Account ORDER BY Name LIMIT 10 OFFSET 20
soqlpaginationlimits