LIMIT
For more details check Check SOQL API - LIMIT.
NOTE! 🚨 All examples use inline queries built with the SOQL Lib Query Builder. If you are using a selector, replace
SOQL.of(...)withYourSelectorName.query().
Specify the maximum number of rows to return.
SOQL
Traditional SOQL
SELECT Id
FROM Account
LIMIT 100
SOQL Lib
SOQL Lib Approach
SOQL.of(Account.SObjectType)
    .setLimit(100)
    .toList();