Oracle Query Performance Optimization practices

Source: Internet
Author: User

?

1. Principles of Index use

?

Do not use full blur on the index, but like ' asdf% ' is possible, that is, do not contains, available Startwith

Do not perform functions on the index, expression operations, or use is null to determine, otherwise the full table scan will be used

Does not equal also causes a full table scan, using column < ' A ' or column > ' a ' instead

If one column has an index and the other has no index, then C1 or C2 will cause a full table scan;

A composite index query, if it contains a leading index, will take effect, otherwise the full table will be scanned;

?

2. Order

?

Where statement: Try to put a large range of filters in the back;

Table connection: The table with large-scale data filtering is placed behind;

?

3. Implementation plan

?

Learn to view execution plans in Sqldeveloper

General principle: Avoid full-scale scan and use index.

Eg:

General Query

?

Plus index optimization:

The index is used for data within 10 days. Where order_id is an index column of the OI table

?

and (Oi. order_id like ' 150913% ' OR oi. order_id like ' 150914% ' OR oi. order_id like ' 150915% ' OR oi. order_id like ' 150916% ' OR oi. order_id like ' 150917% ' OR oi. order_id like ' 150918% ' OR oi. order_id like ' 150919% ' OR oi. order_id like ' 150920% ' OR oi. order_id like ' 150921% ' OR oi. order_id like ' 150922% ' OR oi. order_id like ' 150,923% ')

?

The speed is increased several times, of course, this should be from the design of space, avoid large table scan.

?

Oracle Query Performance Optimization practices

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.