Oracle has a lot to learn about. Here we mainly introduce the Oracle driver table, including the usage of hints. CBO selects the Oracle driver table based on the statistical information. If no statistical information is available, select the Oracle driver table from left to right in the from clause. This is in the opposite order of RBO selection. This is the original English version (CBO determines join order from costs derived from gathered statistics. if there are no stats then CBO chooses the driving order of tables from LEFT to RIGHT in the FROM clause. this is OPPOSITE to the RBO ).
I still cannot confirm the correctness of this sentence. However, after verification, the statement "if ordered is used (CBO must be used at this time), select the Oracle driver table from left to right in the from clause" is correct. In fact, in CBO, if there is statistical data (that is, the table and index are analyzed), the optimizer will automatically decide which connection type to use based on the cost value, and select the appropriate Oracle driver table, this has nothing to do with the locations of each restriction condition in the where clause. If we want to change the connection type or Oracle driver table selected by the optimizer, we need to use hints. The usage of hints will be introduced later.
If I create three tables:
- create table A(col1 number(4,0),col2 number(4,0), col4 char(30));
- create table B(col1 number(4,0),col3 number(4,0), name_b char(30));
- create table C(col2 number(4,0),col3 number(4,0), name_c char(30));
- create index inx_col12A on a(col1,col2);
Run the query:
- select A.col4
- from B, A, C
- where B.col3 = 10
- and A.col1 = B.col1
- and A.col2 = C.col2
- and C.col3 = 5;
- Execution Plan
- Oracle document Learning Experience
- How to Understand the execution plan generated by Oracle
- Oracle table join
- Analysis of four categories of Oracle index Scanning
- Master talk about Oracle index Scanning