Questions tagged [selectivity]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
11
votes
2answers
136 views

SOQL query selectivity changes with number of IN clause records

I have a custom object with a Master-Detail relationship to Opportunity. The relationship field to the parent Opportunity is automatically indexed. There are 200,000 plus of these custom objects in ...
3
votes
1answer
33 views

selectivity threshold + OR condition in where clause

I'm facing trouble in understanding salesforce documentation, about selectivity threshold if SOQL uses two fields in where clause with 'OR' Condition. For e.g. Select id from account where FieldA = ...
0
votes
2answers
66 views

Data skew exists whereby the number of matching rows is very large

I am getting the following Error. works fine in DEV org but throwing error in UAT. Please suggest me as I was unable to move forward. The Actual Error is The first validation error encountered was ...
1
vote
1answer
53 views

SOQL and Indexes

I am trying to understand more about "SOQL Query Performance" topic and I'm reading all the Salesforce docs. I have a doubt when we have a WHERE clause with an AND condition. The two docs on this ...
2
votes
0answers
51 views

Non-selective query against large object type (more than 200000 rows) -for querying with id

I am getting the below error in the trigger on Update: Non-selective query against large object type (more than 200000 rows) -for querying with id Query select id ,Calendar__c, (select id from ...
1
vote
1answer
36 views

Is this a selective SOQL?

Select Id, Field1_Id__c, Field2__c from CustomObject__c where Field1_Id__c =: STRING_CHARACTER_BLANK AND Field2__c IN: setOfIds Getting the following error when a query as above is executed from a ...
-3
votes
1answer
256 views

How to run SOQL for an Object having more than 200K records?

I’m trying to populate a custom lookup field called Part Name( API Name: Part_Number__c) on Case Object, where Part Name field is a lookup to Product Object( Maps to Product Name). We’ve 3 Picklist ...
2
votes
3answers
91 views

Non-selective query against large object type error when querying task

I have a bit of code in production that was working for about 3 days, then started failing with the old 'Non-selective query against large object type (more than 200000 rows)'. Here's the query: ...
2
votes
0answers
65 views

Intermittent non-selective query

tl;dr: I believe that my particular query is selective, but Salesforce occasionally insists it isn't. Evidence follows. What am I missing? ==== Every now and again (7-8 occurrences since 2017-1-1), ...
1
vote
2answers
306 views

Non-selective query against large object type error even on an indexed field

I have the dreaded Non-Selective query error but I am not sure why. I am on the Lead object and querying against 3 fields which are indexed so I am not sure why I am getting this error. I do have over ...
1
vote
1answer
256 views

Need Help Optimizing SOQL Query For 100,000+-Record Table (old query, suddenly failing)

Although my org seems to have had over 100,000 Task records for quite some time (as of this morning, we're at 119,479), between a week ago and yesterday two of the test methods that come with an ...
1
vote
3answers
229 views

SOSL: System.QueryException: Non-selective query against large object type (more than 100000 rows)

We have over 100,000 contacts to query the system to get this error. SOSL: System.QueryException: Non-selective query against large object type (more than 100000 rows) However, this error is only ...
5
votes
1answer
485 views

How do I see query plan (explain) data for a given SOQL query?

Given any SOQL query (which for the sake of this question we can assume doesn't use apex bind variables), how can I determine things like what indexes (if any) are being used, and if the query is ...
5
votes
2answers
864 views

QueryException: Non-selective query against large object type for custom object with no records

I have a custom object in a managed package that currently has no records in the customers org. Lets call it DFB__ProductUdfMap__c (namespaces etc... have been changed to protect the innocent). The ...
2
votes
3answers
655 views

Error: System.QueryException: Non-selective query

I get this error.. System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing. Even if ...
0
votes
1answer
477 views

How can I make my SOQL query of Contacts filtered by AccountID more selective?

I am building a trigger on the Account object to calculate various task rollups (Completed Calls, Completed Emails, Open Tasks, etc..), and I am trying to make it also account for tasks that are ...
2
votes
1answer
637 views

System.QueryException: Non-selective query against large object type with 0 records

I am getting the following error for a query I am running dynamically System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or ...
0
votes
0answers
20 views

Is there a way to tell if custom indexes exist on an object?

I want to be able to design to use indexes and custom indexes where they exist. Is there a way to tell if custom indexes have previously been created on a field?
2
votes
2answers
458 views

Approaching limit for non-selective query: How to find the offending query?

I am getting following warning email but can not find out where exactly the problem is. I am facing problem in finding out which SOQL query is causing issue. Any help will be much appreciated :) ...
5
votes
1answer
632 views

Non-Selective Query Exception on Task Query

I have the following three SOQL queries in a class that is being called by a Trigger. The Trigger counts the number of completed tasks and events for a given account. List<Account> accounts = [...
7
votes
1answer
2k views

QueryException: Non-selective query (it is selective)

I am trying to query a Custom Object called Lead_Assignment__c based on some criteria. Original query below: List<Lead_Assignment__c> leadAssignments = [ SELECT Segment__c, Queue_Name__c, ...
3
votes
2answers
5k views

“Non-selective query against large object type” only occurs in trigger context despite filtering on lookups

I have a very simple after delete trigger that searches for orphan records and deletes them: List<my_ns__Orphanable_Object__c> orphans = Database.query( ' SELECT ' + ' Id ' + ' ...