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
M AnM An 

how many SOQL can use in trigger and in class?

Hi all,

I referred this link https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_gov_limits.htm
Here they said generally for synchronous and asynchronous. Also, they mentioned Total number of SOQL queries issued in the description table, here issue means? 
Also, I want to know how many SOQLcan uses in Trigger and in Class.
Suraj TripathiSuraj Tripathi

Hi,

Synchronous means calling the apex class using Visualforce page, Trigger, Execute Anonymous of dev console. These type of call hold the process until they complete and run in main transaction thread So Total number of SOQL queries are 100.

Asynchronous operations are calling apex using batch, Future methods. These process run in background and don't affect the main transaction thread. They run is separate independent thread with their independent governor limits from main transaction so Total number of SOQL queries are 200 .

Regards,

Suraj

Dev_AryaDev_Arya
hi M An,

issue means, the number of queries allowed per transaction. Now offcourse these words seem similar to the documentation. To clarify, when you send a request to server, calling a function or any event which invokes a trigger, the total number of queries you can process through these functions or triggers are the "number of queries issued". And at the moment this limit is 200. You can use Apex functions like Limits.getLimitDMLRows() , Limits.getQueries() etc to check ur limits with in APEX.

Still having doubts, raise your hand here. Otherwise mark the solution as gree, :-)

Cheers,Dev