• Denis Ivancik
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
i am thinking following SOQL query cauisng timeout firstime.
 for(Question__c quest :[SELECT id,Question_Text__c,Picklist_Options__c ,
                                    Type__c,Order__c,recordTypeId,recordType.name,
                                    Display_Dependant_Value__c,Display_Dependant_Question__c
                                    FROM Question__c 
                                    WHERE Template_Question__c = null
                                    AND((recordType.name =: System.Label.Record_Type_Standard_Template)
                                    OR (Id in: compQuesSet AND recordType.name =:System.Label.Record_Type_Custom_Template)
                                    OR (recordType.name =: System.Label.Record_type_Form_Question 
                                        AND 
                                        Requisition__c =: requisition.Id))
                                    Order by Order__c
                                    ]){

Currently there are 1 million question_c objects in system.

here debug log statistics..
Number of SOQL queries: 2 out of 100
  Number of query rows: 5619 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 3 out of 150
  Number of DML rows: 47 out of 10000
  Maximum CPU time: 9433 out of 10000 ******* CLOSE TO LIMIT
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

I am not sure why it is only fisrt time happening to users? How to solve?