我想这个查询:顶点查询优化
List<Account> onlyRRCustomer = [SELECT
ac.rr_First_Name__c,
ac.rr_Last_Name__c,
ac.rr_National_Insurance_Number__c,
ac.id,
ac.rr_Date_of_Birth__c
FROM
Account ac
WHERE
ac.rr_National_Insurance_Number__c IN :uniqueNiInputSet
AND RecordTypeId = :recordTypeId];
它给了我一个错误:
SELECT ac.rr_First_Name__c, ac.rr_Last_Name__c, ac.rr_National_Insurance_Number__c, ac.id, ac.rr_Date_of_Birth__c FROM Account ac WHERE (ac.rr_National_Insurance_Number__c = :tmpVar1 AND RecordTypeId = :tmpVar2) 10:12:05.0 (11489528)|EXCEPTION_THROWN|[49]|System.QueryException: Non-selective query against large object type (more than 200000 rows). Consider an indexed filter or contact salesforce.com about custom indexing.
我明白uniqueNiInputSet.size()〜50,所以,这不是一个问题,但对于该记录类型,它可能包含更多的记录。
那么,如果我改变了职位将工作?首先是记录类型,然后是where子句中的NIset。是否有顺序如何在SF中选择where子句。那么,它只会查找50个成员,然后在50个以内,它将查找特定的记录类型?