日期:2014-05-17  浏览次数:20981 次

file$是干嘛用的?
跟踪一个存储过程,发现该存储过程耗费的时间有一半是用在查询file$的,具体如下:
********************************************************************************
select file# 
from
 file$ where ts#=:1

call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 206 0.01 0.00 0 0 0 0
Execute 40796 40.42 582.07 0 0 366674 0
Fetch 406 0.01 0.00 0 790 0 214
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 41408 40.44 582.09 0 790 366674 214

Misses in library cache during parse: 0
Optimizer mode: CHOOSE
Parsing user id: SYS (recursive depth: 2)

Rows Row Source Operation
------- ---------------------------------------------------
  1 TABLE ACCESS FULL FILE$ (cr=4 pr=0 pw=0 time=35 us)

********************************************************************************

不知道file$是用来干嘛用的,为什么会这么耗时呢?亟盼解答啊!

------解决方案--------------------


Rows Row Source Operation
------- ---------------------------------------------------
1 TABLE ACCESS FULL FILE$ (cr=4 pr=0 pw=0 time=35 us)


慢的原因在这:TABLE ACCESS FULL,做的是全表扫描,在相关表上加索引看看...



------------------------------------------ 
Blog: http://blog.csdn.net/tianlesoftware 
网上资源: http://tianlesoftware.download.csdn.net 
相关视频:http://blog.csdn.net/tianlesoftware/archive/2009/11/27/4886500.aspx 
DBA1 群:62697716(满); DBA2 群:62697977
------解决方案--------------------
file$是sys用户下关于表空间的数据文件的字典表,
不知楼主取得file#文件号的目的。
并且sys.file$的ts#字段上有一个复合索引I_FILE2,
不使用该索引的原因可能是该表的数据可能较少。