在Oracle数据库中,当我获得执行计划或解释计划时,哪个行源被视为驱动表?是一个高于另一个吗? 还是在嵌套联接,合并联接等方面发生了变化? 此外,如果我通过SQL Developer获得执行计划或解释计划命令等,它会更改吗? 我知道优化器会选择较小的表作为驱动表。但我知道,它并非一直如此。所以我对此感到困惑。 顺便说一句,我要问的是基于成本的优化。因此,如果您可以在CBO上进行解释,将不胜感激。 例如,在下面的计划中,行驶台是哪个?我们如何理解它是驾驶台?是因为它在最上面吗? 最好的问候
select * from hr.employees e join hr.departments d on d.department_id =
e.department_id where d.department_name like 'A%'
Plan hash value: 1021246405
--------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 4 (100)| |
| 1 | NESTED LOOPS | | 10 | 900 | 4 (0)| 00:00:01 |
| 2 | NESTED LOOPS | | 10 | 900 | 4 (0)| 00:00:01 |
|* 3 | TABLE ACCESS FULL | DEPARTMENTS | 1 | 21 | 3 (0)| 00:00:01 |
|* 4 | INDEX RANGE SCAN | EMP_DEPARTMENT_IX | 10 | | 0 (0)| |
| 5 | TABLE ACCESS BY INDEX ROWID| EMPLOYEES | 10 | 690 | 1 (0)| 00:00:01 |
--------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
3 - filter("D"."DEPARTMENT_NAME" LIKE 'A%')
4 - access("D"."DEPARTMENT_ID"="E"."DEPARTMENT_ID")
Note
-----
- this is an adaptive plan