Oracle performance optimization operation 5: Remove & quot; & lt; & gt; & quot; whenever possible, oracle Performance Optimization

Source: Internet
Author: User

Oracle performance optimization operation 5: Remove "<>", oracle performance optimization whenever possible

Oracle performance optimization operation 5: Remove "<>" whenever possible"

Remove "<>" whenever possible to avoid full table scan. If the data is an enumeration value and the value range is fixed, change it to "OR.

Example:

<Span style = "font-size: 18px;"> update serviceinfo set state = 0 where state <> 0; </span>

Because the preceding statement contains "<>", full table access full is used in the execution plan, and the index on the state field is not used.

In practice, due to the limitation of business logic, the Field state is an enumerated value, which can only be 0, 1 or 2, and the value is equal to or less than 1 or 2.

Therefore, you can remove "<>" and use indexes to improve efficiency.

To:

<Span style = "font-size: 18px;"> update serviceinfo set state = 0 where state = 1 or state = 2; </span>

For further modifications, see oracle performance optimization operation 4 ".

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.