The SQL Server index is invalidated under what circumstances

Source: Internet
Author: User

Indexes do not always take effect, such as the following, which will invalidate the index :

  1. If there is an or in the condition, it will not be used even if there is a conditional index ( which is why the use of or is minimized )

  

Note: If you want to use or, and you want the index to take effect, you can only index each column in the OR condition

2. For multi-column indexes, not the first part of use, the index is not used

3.like queries are preceded by%

4. If the column type is a string, be sure to use quotation marks in the condition to reference the data, otherwise you will not use the index

  

  

Show status like ' handler_read% ';
We can note:
Handler_read_key: The higher the value the better, the higher the number of times the index is queried Handler_read_rnd_next: The higher the value, the less efficient the query

The SQL Server index is invalidated under what circumstances

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.