Oracle performance optimization operation 4: Remove & quot; IN & quot;, & quot; OR & quot; whenever possible. oracle Performance Optimization

Source: Internet
Author: User

Oracle performance optimization operation 4: Remove "IN", "OR" whenever possible, oracle Performance Optimization

The Where clause containing "IN" and "OR" usually uses a worksheet to invalidate the index;

If a large number of duplicate values are not generated, consider splitting the sub-statement. The split sub-statement should contain the index.

Example:

Select count (*) from stuff where id_no in ('0', '1'); -- (23 seconds)

You can consider separating the or clause:

Select count (*) from stuff where id_no = '0'; select count (*) from stuff where id_no = '1 ';

Then, let's make a simple addition. The query speed is faster than that of the original SQL statement.

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.