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
Chamil MadusankaChamil Madusanka 

Understanding Execution Governors and Limits

Hi All,

 

There are lots of execution governors and limits in salesforce. But I'm confusing from these governors are applying per organization or per user. OR are there any categorization for per organization limits and per user limits?

 

Thanks in Advance

Best Answer chosen by Admin (Salesforce Developers) 
kiranmutturukiranmutturu

each individual sub query is going to count another query.. and coming to user point of view each individual user is a new instance . so the governing limits is differ from one user to other...

 

 

problem is when a user is going to work with more than 100 soql queries then it will be a problem for that instance...

All Answers

kiranmutturukiranmutturu

Governor limits apply to an entire organization, Any resources it uses counts against the total for your organization.

Chamil MadusankaChamil Madusanka

That mean there are no any governor limit that apply for an user. All the limits are apply to organization. Isn't it?

kiranmutturukiranmutturu

ya its not specific to any user.. 

Chamil MadusankaChamil Madusanka

Hi All,

 

Still I'm confusing with governors limits.

 

Let me eloborate this question. Let's get one limit

 

"Total number of SOQL queries issued -- 100"

 

This limit has been explained as follows;

 

"In a SOQL query with parent-child relationship sub-queries, each parent-child relationship counts as an additional query. These types of queries have a limit of three times the number for top-level queries. The row counts from these relationship queries contribute to the row counts of the overall script execution"

 

According to this limit, If we have SOQL query with parent-child relationship sub-queries(Let's think it has 2 sub-queries), then I have to clarify few things.

 

  1. How many queries to be consider there?
  2. If I have 100 users and they all are going to execute above query, then are there any issue?

Thanks in Advance

 

kiranmutturukiranmutturu

each individual sub query is going to count another query.. and coming to user point of view each individual user is a new instance . so the governing limits is differ from one user to other...

 

 

problem is when a user is going to work with more than 100 soql queries then it will be a problem for that instance...

This was selected as the best answer
zachelrathzachelrath

To simplify things, each User interaction represents a separate "execution context"---and Governor limits are only enforced per execution context.

 

Example:

You have a before insert Trigger on Contact which performs a SOQL query to see if there are any duplicate Contacts within the new Contact's Account, and a SOQL query on Account to autopopulate the Contact's Mailing Address using the Account's Billing Address. Assuming that these queries are performed in bulk (i.e. you're not making 2 separate SOQL queries for each Contact coming in through the Trigger, but rather building a list of Account Ids and Contact Names to query against and then doing 2 gigantic SOQL Queries), then you are only using up 2 out of 100 SOQL queries every time this Trigger is invoked. Each Trigger invocation constitutes a separate execution context.

 

Execution Context 1---User A inserts 5810 new Contacts using the Apex Data Loader. The Contact trigger runs, and makes 2 SOQL queries. You have, therefore, only used up 2  out of the 100 SOQL queries allotted for this execution context.

Execution Context 2—User B inserts a new Contact using the Standard UI. The Contact trigger runs, and makes 2 SOQL queries. 2 out of the 100 SOQL queries allotted for this execution context have been used up.

Execution Context 3—User C inserts 45,800 new Contacts using the Apex Data Loader. Again, the Contact trigger runs, and only 2 SOQL queries are used for this Execution Context, so no governor limits are exceeded.

 

Hope that helps.

 

Zach McElrath

Skoodat LLC

Prajapati.LakhanPrajapati.Lakhan

Hi,

 

I found one conflict regarding this topic in other post :

http://boards.developerforce.com/t5/Apex-Code-Development/SOQL-Governor-limits-on-nested-queries/td-p/189252

 

Please specify the reason which one is correct, practically, document seems to be futile asI ran nested SOQL and used Limits.getQueries() method to find out number of queries issued, it returns only 1.

 


Regards,

Lakhan