You need to sign in to do that
Don't have an account?
100 SOQL Limit per Transaction
Hey everyone-
We are reaching the 100 SOQL query per transaction in our custom Apex object. Is there a work around or way to get our limit increased?
We are reaching the 100 SOQL query per transaction in our custom Apex object. Is there a work around or way to get our limit increased?
Sounds like you are hitting some apex governor limits. More on this here (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_gov_limits.htm). Although there isnt really a way to get these increased or removed, You can try to optimize your code to prevent these limits from being hit. Try removing SOQL from loops/triggers as best you can, querying the whole set of records and filtering manually instead of querying in parts. Things like this can help reduce your soql count. If you provide some code I will be more than happy to help with this.
Hope this helps!
AM
Are you trying bulk data operation? It looks like you have a trigger written on the object and its not bulkified. You cannot increase this limit (remeber salesforce is a multitenant architecture!). Paste your trigger code here, it wont take much time to resolve.
Can you take a moment to upvote and mark this answer as solved, if it helped you.
Cheers!
Ajinkya Deshmukh
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_invoking_future_methods.htm
Most likely the 100 limit is being approached due to bad programming practices though. Try to refactor the culprit code to only use SOQL when you absolutely need to, and make combined calls when you can.
- workaround ? The general idea: loading the most of the data into collections (Set, List and Map), creating formulas and rollup-summaries for reducing the number of overall SOQL number of calls.
Best Practice #1: Bulkify your CodeBest Practice #2: Avoid SOQL Queries or DML statements inside FOR Loops
Best Practice #3: Bulkify your Helper Methods
Best Practice #4: Using Collections, Streamlining Queries, and Efficient For Loops
https://developer.salesforce.com/index.php?title=Apex_Code_Best_Practices
- limit increased? there is only one exception with the asynchronous limit (200 instead of 100)
using: Future Methods, Batch Apex, Queueable Apex and Scheduled Apexhttps://trailhead.salesforce.com/en/asynchronous_apex/async_apex_introduction
Regards
Alain