[SalesForce] Does the SOQL Query Plan tool always do a table scan because of IsDeleted

I'm trying to use the Query Plan tool in the developer console for the first time.

Every single query that I try ends up with a table scan, because of the IsDeleted field not being indexed. The notes always have this for every table in the query:

Not considering filter for optimization because unindexed.
Table: Opportunity Fields: ["IsDeleted"]

Even if the query is as basic as:

select Id from Opportunity
where id = 'xxxxxxxxxxxxxxx'

enter image description here

And with queries with joins you end up with things like:

enter image description here

Is this normal ?

Best Answer

It only uses the lowest cost plan. Anything below that is irrelevant and can be safely ignored. So since your Index query has a Cost of 0.00001, that's what the Query Optimizer will use at run time.

Note from Query Plan Tool (How To & FAQ):

What does it all mean?
The Query Plan tool will show a list of available plans that our Query Optimizer can utilize for the query provided and will be arranged by cost ascending. Each Plan will contain information on Cardinality, Operation Type, Cost, sObject Type, and more. Each plan has a “Leading Operation Type”, for example, Field Index or Full Table Scan. The plan with the lowest cost is the plan that is used for driving the query execution.

Related Topic