Loading
Salesforce から送信されるメールは、承認済ドメインからのみとなります続きを読む

Make a SOQL query selective by marking a field as External ID or Unique

公開日: Oct 13, 2022
説明
If you run into a "Non-selective query against large object type" error when performing a SOQL query or it takes a long time to run, you may make it selective if it filters by a Text field by marking it as External ID.

 
解決策
Salesforce will automatically create an index on a field marked as External ID. If the field is not part of a managed package, contact your system administrator for assistance.

When a Text field is marked as External ID it gets automatically indexed, so the query optimizer will check if its index can be leveraged to drive the query execution. This may help for instance if a query similar to the one shown below is used if less than 10% of the fields have their TextField__c set to 'value'. For more information on SOQL optimization check Make SOQL query Selective.

SELECT Name FROM Account WHERE TextField__c = 'value'

NOTES:
a) Uniqueness is not enforced when a field is marked as External ID.
b) Uniqueness is enforced when a field is marked as Unique. In this case Salesforce will create an index on the field too.
c) By marking a field as External ID, you can also use it to perform an upsert() operation if needed.
 
ナレッジ記事番号

000383981

 
読み込み中
Salesforce Help | Article