Skip to main content

#Governerlimts0 discussing

Hi everyone, 

 

Regarding to title, I would like any ideas.

Apex execute insert record and unexpectedly soql queries. but my org doesn't set up trigger and there is disabled flow.

Why is this happening? Does anyone have any ideas?

I would appreciate it if you cloud help.

 

#Apex  #SOQL Queries  #Governerlimts

6 answers
  1. Feb 26, 2024, 10:17 AM

    Hi @Ryusei Yoshida

     

    If you are observing unexpected SOQL queries being executed even though there are no triggers and flows are disabled, there are a few potential reasons you might want to investigate:

    1. Apex Debug Logs:
      • Enable debug logs for the user who is running the Apex code. This can be done by navigating to Setup > Monitoring > Debug Logs. This will provide detailed logs that show the sequence of operations and any SOQL queries being executed.
    2. Apex Code Itself:
      • Review the Apex code that is being executed. There might be explicit or implicit queries in the code. Look for any DML operations, queries, or any method calls that might internally perform database operations.
    3. Triggers in Managed Packages:
      • Check if there are any managed packages installed in your org that might include triggers. Even if your org hasn’t set up custom triggers, a managed package might have its own triggers that get executed during certain operations.
    4. Process Builder or Workflow Rules:
      • Ensure that there are no active Process Builder processes or workflow rules that might be executing additional actions, including SOQL queries, when records are inserted.
    5. Asynchronous Processes:
      • Check for any asynchronous processes like future methods or queueable jobs that might be running after the initial record insertion. These processes could include SOQL queries.
    6. Platform Events:
      • If your org uses platform events, check for any triggers or processes associated with the events that might be causing additional queries.
0/9000

In salesforce doc it's mentioned that for async we can fetch upto 10k records using querylocator. But in batch apex trail the statement says that "With the QueryLocator object, the governor limit for the total number of records retrieved by SOQL queries is bypassed and you can query up to 50 million records.".

Can some one explain me how is this possible.

 

#Apex  #Governerlimts  #Salesforce  #BatchClass

3 answers
  1. Sushil Kumar (UKG) Forum Ambassador
    Feb 26, 2024, 1:27 PM

    As i mentioned above, in Batch apex, there are two contexts, One is start method(Here i believe it should be able to fetch upto 50 million records). Execute Context - Here it should only be able to fetch upto 10k as you mentioned. 

0/9000