Some experiences on SQL Optimization

Source: Internet
Author: User

The execution speed of Several SQL statements in the project is relatively slow, so these SQL statements have been being optimized recently. It is very interesting in the optimization process, because every step


A little improvement may improve the execution efficiency. In this regard, I have also summarized some small experiences that are built on the orcle system.




1. When performing a joint query, make sure to estimate the data in the table and then determine the sequence of the table during the query.


2. determine the order of query conditions based on database parsing rules. Here, we recommend that you filter a large amount of data in a table from the very beginning.


2. When performing a query, it is best to directly operate on the table. Therefore, if the table and view perform a joint query, the view is generally split.

4. When performing a query, minimize the number of table accesses. For example, when performing a query, You need to associate the query multiple times.CodeTable, you can consider how to minimize


The number of queries is reduced.


5. For the use of Union and Union all, if you do not need to remove duplicates, try to use Union all. Because union has the deduplication function, the efficiency is relative.




6. For query clauses using in, use exists instead.


7. Do not use sorting or other statements in subqueries.


All of the above are aimed at optimizing Oracle itself under certain Oracle configuration conditions.

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: 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.