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
Gloria Piti 15Gloria Piti 15 

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?
UC InnovationUC Innovation
Hi Gloria,

Sounds like you are hitting some apex governor limits. More on this here ( 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!

Hi Gloria,

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.
Ajinkya Deshmukh
Sean McMickle 10Sean McMickle 10
Don't forget you can always run asyncronously for some bumped up limits! You can use @future and call some batches! Woohoo!

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.
Alain CabonAlain Cabon
  • 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 Code
Best 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
  • limit increased?  there is only one exception with the asynchronous limit (200 instead of 100)
       using: Future Methods, Batch Apex, Queueable Apex and Scheduled Apex