When writing SQL statements, many times you use filter to filter out some records, SQL to filter the criteria for short: SARG (search Argument/sarg)
Copy Code code as follows:
where amount>4000 and amount<6000 the above sentence is the filter condition
Of course, this isn't about SQL Server's WHERE clause, it's about SQL Server's use of indexes in SQL Server for expressions without the SARG operator, indexes are useless, and SQL Server is difficult for them to use the more optimized approach.
It means that if you don't have a WHERE clause in your SQL statement that includes a SARG operator, your SQL statement will not use the index in the table.
Let's say what are the non-SARG operators
Non-SARG operators include
The rule is that there is a "not" keyword or not equal to the meaning of basically not using the index
There are also internal functions that SQL Server will not use if you use these internal functions
Internal functions, for example: CONVERT (), UPPER (), etc.