Development questions

What is a Selective SOQL Query, how does the Query Plan Tool work, and what are the indexing thresholds (30% of first 1M records, 15% after)?

A query is selective when its filter uses an indexed field and returns less than a threshold of the object's records, so the optimizer can use the index instead of a full table scan. Non-selective queries on large objects (over ~100,000 records) can fail in triggers with Non-selective query against large object type.

Thresholds (standard index): roughly 30% of the first 1 million records and 15% after, up to a cap (custom index: 10% / 5%).

Use the Query Plan Tool in the Developer Console: it shows cost per plan; a cost below 1 means selective (index is used).

soqlperformanceselectivityindexes