SQL Server's use of Indexes

Source: Internet
Author: User
SQL Server's use of Indexes

Filter is often used to filter out some records when writing SQL statements)

 
1 WhereAmount>4000 AndAmount<6000

The above statement is the filtering condition.

Of course, this does not mean the SQL server where clause, or SQL Server's use of indexes.

In SQL Server, indexes are useless for expressions without the Sarg operator, and it is difficult for SQL Server to use a more optimized approach for them.

If your SQL statement does not contain the WHERE clauseNon-Sarg OperatorsYour SQL statement will not use the index in the table.

 

Which of the following areNon-Sarg Operators:

Non-Sarg operators include

Not,

<>,

Not exists,

Not in,

Not like

The rule is"Not"Keyword orNot equalBasically, indexes cannot be used.

There are also some internal functions. If these internal functions are used, sqlserver does not use indexes.

Internal functions, such:Convert (), upper (), etc.

 

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.