SQL Server's usage of indexes and non-SARG Operators

Source: Internet
Author: User

Filter is often used to filter out some records when writing SQL statements)
Copy codeThe Code is as follows:
Where amount> 4000 and amount <6000 the above sentence is a filtering Condition

Of course, this does not mean the where clause of SQLSERVER. It means that does not use indexes for expressions without the SARG operator in SQLSERVER. SQLSERVER is difficult to use relatively optimized methods for these expressions.

This means that if no where clause in your SQL statement contains a non-SARG operator, your SQL statement will not use the index in the table.

Which of the following are non-SARG operators?:
Non-SARG operators include
NOT,
<>,
Not exists,
Not in,
NOT LIKE
The rule is that indexes cannot be used basically because of the "NOT" keyword or non-equal meaning.
There are also some internal functions. If these internal functions are used, SQLSERVER does not use indexes.
Internal functions, such as CONVERT () and UPPER ()

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.