Query Plan in Salesforce
The new Query Plan tool in the Developer Console can help speed up SOQL queries done over large volumes. Use the Query Plan tool to optimize and speed up queries done over large volumes. Check the below link for more details
https://www.infallibletechie.com/2015/07/query-plan-in-salesforce.html
The following fields are indexed by default that makes SOQL selective:
1. Primary keys (Id, Name and Owner fields).
2. Foreign keys (Lookup or Master-Detail relationship fields).
3. Audit dates (such as SystemModStamp).
4. Custom fields marked as External ID or Unique.
You can contact Salesforce.com support to make a field indexed(custom index).
Even indexing can fail your SOQL. So, consider the threshold. For standard index, 30% for first 1 million and 15% after that. For custom index 10% for first 1 million and 5% after that.
Check the below link for Salesforce SOQL Cheat Sheet