我有一个查询,如下所示:
select /*+gather_plan_statistics*/
*
from mi_dimcustomer t
where t.CUSTOMER_NUM = 321937表的Unique Index (IDX1_DIMCUSTOMER)在Customer_Num列上。我使用/*+gather_plan_statistics*/提示和Dbms_xplan.display_cursor来获得真正的执行计划,这就是我所得到的:
SQL_ID adj0b6drg6bjd, child number 0
-------------------------------------
select /*+gather_plan_statistics*/* from vmi_dimcustomer t where
t.CUSTOMER_NUM = 321937
Plan hash value: 3784660444
-----------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows | Cost (%CPU)| A-Rows | A-Time | Buffers |
-----------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | | 2 (100)| 1 |00:00:00.01 | 3 |
| 1 | TABLE ACCESS BY INDEX ROWID| MI_DIMCUSTOMER | 1 | 1 | 2 (0)| 1 |00:00:00.01 | 3 |
|* 2 | INDEX UNIQUE SCAN | IDX1_DIMCUSTOMER | 1 | 1 | 1 (0)| 1 |00:00:00.01 | 2 |
-----------------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("CUSTOMER_NUM"=321937)我的问题是关于Operation-2 , Index unique scan.的,据我所知,Index scan中发生的事情只是扫描/搜索Index Page,检索所需的Rowid,然后使用这些Rowid访问表中的正确位置(即op-1),.I不期望操作-2(它只是扫描索引页)来生成任何行!那么为什么我们在op-2的执行计划中看到A-行=1呢?这个数字代表什么?
我的猜测是它将等于从索引页返回的ROWID的数量。
提前感谢
发布于 2022-01-23 12:16:57
您的猜测是正确的,它是从索引返回的枝叶数。这是表access检查的行数,但不一定是它返回的行数(例如,只有在读取行的其余部分之后才能应用另一个筛选器)。
https://dba.stackexchange.com/questions/306459
复制相似问题