You need to sign in to do that
Don't have an account?

Total number of SOQL queries issued for Batch Apex and future methods
Hi,
How to calculate the total number of SOQL queries issued for Batch Apex and Future methods of a VF page using the Limits class or some other alternatives,
Can anyone suggest some idea?
See the following
LIMITS
System.debug('Total Number of SOQL Queries allowed in this apex code context: ' + Limits.getLimitQueries());
System.debug('Total Number of records that can be queried in this apex code context: ' + Limits.getLimitDmlRows());
System.debug('Total Number of DML statements allowed in this apex code context: ' + Limits.getLimitDmlStatements() );
System.debug('Total Number of script statements allowed in this apex code context: ' + Limits.getLimitScriptStatements());
USAGE
System.debug('1.Number of Queries used in this apex code so far: ' + Limits.getQueries());
System.debug('2.Number of rows queried in this apex code so far: ' + Limits.getDmlRows());
System.debug('3. Number of script statements used so far : ' + Limits.getDmlStatements());
System.debug('4.Number of Queries used in this apex code so far: ' + Limits.getQueries());
System.debug('5.Number of rows queried in this apex code so far: ' + Limits.getDmlRows());
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
Well I guess I answered somewhere else!
This shows you how to calculate the number of SOQL for batch apex and insert the same in a custom object
Thanks for you replies.
Consider a situation when the code with batch apex is already implemented with a VF page using the controller. Can i now calculate the No of Queries issued for Batch Apex in that page controller using a new controller whitout changing any code in the existing controller.