Case study – when an indexed field performs slower than a non-indexed one
Just like other databases, Salesforce maintains indexes on important fields of standard and custom objects to improve performance. However, unlike traditional databases, the Salesforce platform is multitenant, so in some cases, its database behaves differently.
Let’s look at a simple custom object. Let’s call it Sample_Obj__c
and let’s create 100,000 test records. Figure 8.1 shows the fields we have created. Please note that the INDEXED column shows the fields where the Salesforce platform is maintaining indexes. So, selecting these fields should result in faster queries:
Figure 8.1 – An overview of a sample object for testing a DataRaptor extract
To make this test easy, we will put the same values in the standard Name
field and the Text_Field__c
custom object in all records. This way, we can query both fields for the same value and compare query...