How to test SOQL performance in Salesforce?

To test SOQL performance in Salesforce, Query Plan in Developer Console can be used.

To enable Query Plan, use the below link

To learn how to use Query Plan tool, use the below link

After executing the query in the Query Plan tool, you will get cost for multiple Lead Operation Type. So, you can use whether to use Table Scan or Indexed fields and so on.