
out of which 200 Records are not Updated and it shows the error like'
caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact
salesforce.comabout 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)
Trigger.RelationshipMapAfterTriggerForContact: line 10, column 1
and My Trigger Was,
trigger RelationshipMapAfterTriggerForContact on Relationship_Map__c (after insert, after update, before insert) {
Set<Id> contactIdSet = new Set<Id>();
for(Relationship_Map__c rm: Trigger.new) {
contactIdSet.add(rm.Contact__c);
}
if(!contactIdSet.isEmpty()) {
Map<Id, Contact> contMap = new Map<Id, Contact>([Select Id, Name, BU_Indicator_Technology__c from Contact where ID IN: contactIdSet]);
Set<Id> validContIdSet = new Set<Id>();
for(Relationship_Map__c rm: [Select Id, Contact__c, Segment__c From Relationship_Map__c Where Segment__c =: 'Technology Consulting' AND Contact__c IN: contactIdSet]) {
validContIdSet.add(rm.Contact__c);
}
for(Contact con: contMap.values()) {
if(validContIdSet.contains(
con.Id)) {
con.BU_Indicator_Technology__c = true;
} else {
con.BU_Indicator_Technology__c = false;
}
}
update contMap.values();
}
}
Can Anyonen Provide Me the Necessary suggetions ASAP.
Your trigger might need some tweaking to make it a bit more effective against large data transfers.
But you can also do this. Turn off the trigger while doing a data import/update. Then enable the trigger when you are done.
Also, when doing an update are you matching my salesforce.com ID for the update? Is it an Upsert?