Oracle Performance Optimization Operations Seven: Indexing improves query efficiency when data distribution is uneven

Source: Internet
Author: User

Indexes can still be used to improve efficiency when the selectivity of the index is low, but the value distribution of the data varies widely.

A, the data distribution is not uniform in the special case, the selective index is also to be created.

The amount of data in table serviceinfo is large, assuming there are 1 million rows, one of which has a field disposalcourseflag, and the value range is the enumeration value: [0,1,2,3,4,5,6,7].

According to the rules established by the previous index, "a field with low selectivity should not be indexed",

This field has only 8 values, the index value is very high repetition rate, the index selectivity is very low, so the index is not built.

However, the distribution of data values on this field is very special, as shown in the following table:

Percentage of the total amount of the range taken
1%
6 98%
7 1%

Moreover, in the common query, the query disposalcourseflag<6 the situation is many and frequent, no doubt, if can establish the index, and is applied,

The query efficiency of this situation will be greatly improved. Therefore, we need to make an index on this field.

Oracle Performance Optimization Operations Seven: Indexing improves query efficiency when data distribution is uneven

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.