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 = 'SomeValue' or FieldB = 'SomeotherValue' ;
Consider both are index fields.
Now I've two versions from 2 Salesforce documentation- if query optimizer consider above fields for indexing or not.
This docuement says:
For OR, the query optimizer uses the indexes unless they all return more than 10% of the object’s records or 333,333 total records.
Key word is 'all'. From above I'm getting, it is fine, if one of them return more than 10% records BUT if 2nd field return less than 10% of records, then index would be used.
but here is another documentation, which says :
When using an OR comparison, all filters must be indexed and under the 10% threshold. . If you have a non-indexed field or one is above 10%, the plan will not be displayed.
This I think, mean to say, both fields should be indexed and both should be returning less than 10% of records.
Which one is correct or If I'm not understanding it properly ?