4

I am trying to evaluate some of our SOQL queries using query plan tool in Developer Console. Query is on custom object and we don't have any custom index on any of the custom field of this object.

when I run a query plan for one of the query, it is showing 2 plans. One is full table scan while other is having Index on custom field Status__c. But this field is not indexed.

enter image description here

Any idea why tool is showing index plan on a field which doesn't have index ?

I looked at FAQ, https://help.salesforce.com/apex/HTViewSolution?id=000199003&language=en_US and it is clearly mentioned that tool will not show fields that are candidate for indexing.

any idea what is going in here ?

6

There is apparently a background process that salesforce runs on a scheduled basis that does some level of analysis of an org's queries and possibly applies custom indexes automatically where it sees a clear advantage to do so.

I can't point to any written documentation of this, but I was told it by a member of their R&D organization at one point in the past. I can't really speak to what conditions it considers either.

Judging by the much, much lower relative cost in the query plan using it I can't help but think that Status__c is truly indexed. There wouldn't be such an amazingly low cost otherwise.

Edit: Indexed is now shown in the setup UI. There's no need to guess if a field is indexed or not.

  • 1
    In this document you can find the quote: "When the Salesforce optimizer recognizes that an index can improve performance for frequently run queries, fields that aren’t indexed by default are automatically indexed." – Adrian Larson Jan 27 '16 at 1:02
1

Venturing a guess here but did you possibly mark the Status__c field as an external id or unique? If so, SFDC automatically marks them as index fields. Please see this stackexchange post for more information: What standard and custom fields are indexed?

  • that field is not marked as external id or unique – apn Sep 26 '14 at 22:02
  • Here is another resource to look for to determine why it was marked as an index: na15.salesforce.com/help/pdfs/en/… if none of these apply, you'll have to contact support as there are no other published reasons. – techbusinessman Sep 26 '14 at 22:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.