Research on Oracle Table query optimization

Source: Internet
Author: User

The following articles mainly focus on Oracle Table query optimization. This article uses three related tables, namely, Table A, table B, and Table C, for demonstration, you can use the following articles to learn about its practical application and functions. The following is a detailed introduction of the article.

There are more than 2000 rows in Table

Table B, 15 million rows

Table C, rows

The database is Oracle9I.

Currently, Table A connects to table B and table B connects to Table C for query. However, after analysis, Oracle always plans to generate MERGE JOIN for tables A and C, you must know that table A is not associated with Table C and can only generate Cartesian sets. In this way, 2000*180000 records will be generated, resulting in a significant reduction in query performance and a huge temporary table.

Is there any good way to enable Table A to connect table B first and then to Table C, or B to connect to Table C first and then to Table.

Note: All connected fields have independent indexes.

The statement is as follows:

 
 
  1. SELECT A.*  
  2. FROM A ,B,C  
  3. WHERE A.COL_A = B.COL_B1 AND B.COL_B2 = C.COL_C  
  4. SELECT A.*  
  5. FROM A JOIN (B JOIN C ON (B.COL_B2 = C.COL_C)) ON (A.COL_A = B.COL_B1)  
  6. SELECT A.*  
  7. FROM (A JOIN B ON A.COL_A = B.COL_B1) JOIN C ON B.COL_B2 = C.COL_C  

The above content is a description of the Oracle Table query optimization problem. I hope it will help you in this regard.

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.