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
Henry McGovernHenry McGovern 

False Apex governor limit warning message from running Flow

I just wanted to post this in case someone else runs into the same issue. We have a Flow on the Lead object that was generating warning messages about exceeding a query limit whenever we ran the Flow.  The email warning referenced a current record count which equaled the number of Lead records in the system, and since we have a similar Flow on the Opportunity object (which has over 100k records and no warning messages) it seemed like a specific issue with the Lead object.

 

Our flow was structured to have a Lead ID passed into the flow as a variable, and then a record lookup would query for the record associated with that Lead ID. Since this was pretty selective, we thought maybe the flow was triggering some custom code elsewhere that had a non-selective query.

 

After an extensive and fruitless search for the offending query, we decided to take the record count over 100k over the weekend to see what happened. Nothing broke, and at first the warning messages hung on the last record count before breaching 100k records. After a few hours the messages just went away. Salesforce did not indicate interest in treating this "false positive" as a bug, so I wanted to make folks aware so they don't loose sleep over their Lead object crashing over a flow. Of course, if you don't have "Send Apex Warning Emails" checked on your User record, then you'll never have to worry about this at all.

 

Here's the warning message:

 

Apex governor limit warning

 

Operation: /apex/HEA_Scheduling_Wizard

By user/organization: 005C0000003OomH/00D80000000czMn

Caused the following Apex resource warnings:

Approaching limit for non-selective query against large object type (more than 100000 rows). Current size is approximately 96592 rows. When the limit is reached, the query will fail. Consider an indexed filter or contact salesforce.com about custom indexing.
Even if a field is indexed a filter might still not be selective when:
1. The filter value includes null (for instance binding with a list that contains null)
2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times)
null
Approaching limit for non-selective query against large object type (more than 100000 rows). Current size is approximately 96592 rows. When the limit is reached, the query will fail. Consider an indexed filter or contact salesforce.com about custom indexing.
Even if a field is indexed a filter might still not be selective when:
1. The filter value includes null (for instance binding with a list that contains null)
2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times)
null

(these emails can be disabled from the user detail page for this user)

RajaramRajaram
I would like to understand your issue a bit more. Can you please work with your account reps and reach out to me? Thanks
Henry McGovernHenry McGovern

Hi Rajaram,

 

I'm not sure if my CFL rep ever followed up with you, but we could never get it to repeat in our org after passing the 100k record limit. I'm a huge fan of Flows and am happy to help de-bug in any way.

 

Thanks,

Henry

bryan.revelant1.37597257860137bryan.revelant1.37597257860137
 

@Henery

 

Are you able to to loop through 100k records and save them? I am having a hard time doing this. Seems like it cannot be done.

Henry McGovernHenry McGovern

I don't think it was ever actually looping through 100k records in my case. The Record Lookup had a filter that specified the exact record ID, so it really only queried for one record within an object containing over 100k records.  My sense is that the error message I got was a 'false positive' given that nothing ever failed (just got warning messages). Hope that helps.

bryan.revelant1.37597257860137bryan.revelant1.37597257860137

No but thats ok.. I tried to kinda do like a bulk insert using flow. I was going to use flow as the UI however I found many bugs in it. I took the logic without using it as a UI. I was looping trough a couple of objects and records successfully. However when I had to many records it failed. I think it is based on a govnor limit. Kinda dissappointing.