Query Plan tool in the Developer Console can help speed up SOQL queries done over large volumes. This will come handy when dealing with the Non Selective Queries concern.
Make sure you enable the query plan in the developer console preferences
Ensure that you have View All Data permission
In detail, this tool will help you know the performance of each query and why certain queries are taking more time and helps in finding the reason behind the lag.
Enter the query or report or list view ID in the Query Editor and hit enter, It will generate the Query Plan containing
The estimated number of records that the leading operation type would return. For example, the number of records returned by an index.
The indexed field(s) used by the query. If the leading operation type is Index, the fields value is Index. Otherwise, the fields value is null.
The primary operation type that Salesforce will use to optimize the query.
Index - The query will use an index on the query object.
Other - The query will use optimizations internal to Salesforce.
Sharing - The query will use an index based on the sharing rules associated with the user who is executing the query. If there are sharing rules that limit which records that user can access, Salesforce can use those rules to optimize the query.
TableScan - The query will scan all records for the query object.
An array of one or more feedback notes. Each note contains:
description - A detailed description of an aspect of the optimization. This could include information on optimizations that could not be used, with details on why the optimization was not used.
fields - An array of one or more fields used for the optimization.
tableEnumOrId - The table name for the fields used for the optimization.
This response field is available in API version 33.0 and later.
The cost of the query compared to the Force.com query optimizer’s selectivity threshold. Values above 1 mean that the query won’t be selective.
The approximate record count for the query object.
sobjectType will be the name of the queried object
Query plan reports help you decide when to request a custom index from Salesforce Support.