Activity › Forums › Salesforce® Discussions › What are Cursors in Salesforce?
-
What are Cursors in Salesforce?
Posted by Manpreet on April 25, 2017 at 1:38 PMWhat exactly do we mean if we say “A user can have up to 50 query cursors open at a time”.
Shweta replied 6 years, 3 months ago 4 Members · 3 Replies -
3 Replies
-
Hi Manpreet
a cursor is a reference to the the result set for a soql query.
Select Id, name, (select Id, name from contacts) from account
Will account for 2 open cursors.
The way out was to simplify the soql queries and break what we were trying to achieve in one batch apex class over 2 classes.
Hope it may help
- [adinserter block='9']
-
Cursors, as I understand, are the equivalent of query result sets. A similar concept exists in SQL if you’re familiar with it.
So I’d say a cursor is a reference to the result set for a soql query.
I had a support case with Salesforce a while ago about cursors exceeded in a batch apex query. Apparently even inner queries will account for their own cursor set
So
Select Id, name, (select Id, name from contacts) from accountWill account for 2 open cursors.
The way out was to simplify the SOQL queries and break what we were trying to achieve in one batch apex class over 2 classes.
-
Cursors : It is equivalent to the Soql query result set. In cursor a user can have up to 10 query cursors open at a time. If 10 QueryLocator cursors are open in the application and the same user, attempts to open a new one, then the oldest of the 10 cursors is released. If the client application attempts to open the released query cursor, an error results.
Log In to reply.