Activity Forums Salesforce® Discussions How can I count the number of SOQL statement received in a request in Salesforce?

  • Prachi

    Member
    August 12, 2019 at 9:02 am

    Hi laveena,

    You can use debug log in developer console.

    In the bottom of page it will give you result like this

    11:48:38.109|CUMULATIVE_LIMIT_USAGE
    11:48:38.109|LIMIT_USAGE_FOR_NS|(default)|
    Number of SOQL queries: 8 out of 100
    Number of query rows: 9 out of 50000
    Number of SOSL queries: 0 out of 20
    Number of DML statements: 20 out of 150
    Number of DML rows: 20 out of 10000
    Number of script statements: 583 out of 200000
    Maximum heap size: 0 out of 3000000
    Number of callouts: 0 out of 10
    Number of Email Invocations: 0 out of 10
    Number of fields describes: 0 out of 100
    Number of record type describes: 0 out of 100
    Number of child relationships describes: 0 out of 100
    Number of picklist describes: 0 out of 100
    Number of future calls: 0 out of 10

    11:48:38.109|CUMULATIVE_LIMIT_USAGE_END

    Please check below post to avoid limit
    https://developer.salesforce.com/page/Best_Practice:_Use_of_the_Limits_Apex_Methods_to_avoid_Hitting_Governor_Limits

    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());

    Thanks.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos