You need to sign in to do that
Don't have an account?
20万件エラーについて
日頃より大変お世話になっております。
下記のようなエラーが出て困っております。
対応として出来る限り外部ID項目に変更致しましたが、数式項目が引っ掛かているようで困っております。
サポートからは、下記の通りAPEXのWhere句を変更するよう言われておりますが、どう変えたらいいか分かりません。
誰か助けてください。
(現在のWhere句)
Where NyukoBango__c = :nyukouNo
※数式項目です。
(エラー解消が見込めるWhere句サンプル)
Where NyukoBangoEigyoBango__c = :<新規バインド変数>
AND NyukoBangoDate__c = :<新規バインド変数>
AND NyukoBangoRenban__c = :<新規バインド変数>
AND NyukoBango__c = :nyukouNo
(エラー内容)
Apex script unhandled trigger exception by user/organization: 00510000000v3ki/00D10000000KCEI ItemTrigger: execution of AfterUpdate caused by: System.QueryException: Non-selective query against large object type (more than 200000 rows). 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) Class.ItemTriggerHandler.setReOutputInfo: line 534, column 1 Class.ItemTriggerHandler.OnAfterUpdate: line 56, column 1 Trigger.ItemTrigger: line 20, column 1
You will continue receiving this error until you make the query selective
I recommend taking a look at this help article if you haven't already. If you're running a trigger on objects that have more than 200,000 records, you'll receive the error, "System.QueryException: Non-selective query against large object type."
Resolution
You may find that the query in question needs to be more selective in the WHERE clause. According to the Salesforce standards & best practices - the where clause needs to subset 10% or less of the data. this error until you make your query selective
If custom indexing doesn't work, I recommend adding more filters to the query. An example of a selective filter is CreatedDate = THIS_WEEK
Make SOQL query selective
Query & Search Optimization Cheat Sheet
I encourage adding more filters to the query to further optimize the query and make it more selective. You can look at the cheat sheet above to see the list of already indexed fields that you can consider adding to the query for example CreatedDate
If you cannot add more filters and can give a business justification, Support can reach out to the database team to check the possibility of creating a skinny table
You can learn more about skinny tables here:
If you find this information helpful, please mark this answer as Best. It may help others in the community
Thanks,
Anudeep