function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sfdc startsfdc start 

IN SOQL max limt and offset................?

in sosl max limit and offset
NagendraNagendra (Salesforce Developers) 
Hi sfdc start,

The SOSL statement character limit is tied to the SOQL statement character limit defined for your organization. By default, SOQL and SOSL queries cannot exceed 20,000 characters.
  1. The search engine looks for matches to the search term across a maximum of 2,000 records (this limit starts with API version 28.0).
  2. SOSL applies different limits for a given object or situation. If the search is for a single object, the full record limit is applied. If the search is global across multiple objects, each object has individual limits that total 2,000 records.
  3. Admins (users with the View All Data permission) see the full set of results returned.
  4. For all other users, SOSL applies user permission filters. Individual users see only those records that they have access to. Results sets and order vary by the user issuing the search and can change throughout the day as records are added or removed from the index.
SOSL Limits for External Objects:
  • To include an external object in SOSL and Salesforce searches, enable search on both the external object and the external data source. However, syncing always overwrites the external object’s search status to match the search status of the external data source.
  • Only text, text area, and long text area fields on external objects can be searched. If an external object has no searchable fields, searches on that object return no records.
  • External objects don’t support the following.
  1. INCLUDES operator
  2. LIKE operator
  3. EXCLUDES operator
  4. toLabel() function
  • External objects also don’t support Salesforce Knowledge-specific clauses, including the following.
  1. UPDATE TRACKING clause
  2. UPDATE VIEWSTAT clause
  3. WITH DATA CATEGORY clause
  • External objects must be specified explicitly in a RETURNING clause to be returned in search results. For example:
FIND {MyProspect} RETURNING MyExternalObject, MyOtherExternalObject

Please refer to the below image for more information:

User-added image

OFFSET:When expecting many records in a query’s results, you can display the results in multiple pages by using the OFFSET clause on a SOQL query. For example, you can use OFFSET to display records 51 to 75 and then jump to displaying records 301 to 350. Using OFFSET is an efficient way to handle large results sets.

Use OFFSET to specify the starting row offset into the result set returned by your query. Because the offset calculation is done on the server and only the result subset is returned, using OFFSET is more efficient than retrieving the full result set and then filtering the results locally. OFFSET is available in API version 24.0 and later.
 
SELECT ***fieldList***
FROM objectType
[WHERE conditionExpression] 
ORDER BY fieldOrderByList
LIMIT numberOfRowsToReturn
OFFSET numberOfRowsToSkip
As an example, if a SOQL query normally returned 50 rows, you could use OFFSET 10 in your query to skip the first 10 rows:
 
SELECT Name
FROM Merchandise__c
WHERE Price__c > 5.0
ORDER BY Name
LIMIT 100
OFFSET 10

The result set for the preceding example would be a subset of the full result set, returning rows 11 through 50 of the full set.

Considerations When Using OFFSET:

Here are a few points to consider when using OFFSET in your queries:
  • The maximum offset is 2,000 rows. Requesting an offset greater than 2,000 will result in aNUMBER_OUTSIDE_VALID_RANGE error.
  • OFFSET is intended to be used in a top-level query, and is not allowed in most sub-queries, so the following query is invalid and will return a MALFORMED_QUERY error:
Note:Using OFFSET in sub-queries is a pilot feature that is subject to change in future releases, and is not intended for use in a production setting. There is no support associated with this pilot feature.

Please mark it as the best answer if its solved.

Best Regards,
Nagendrta.
P