一. Recursive Calls 说明
在执行计划的统计信息里有如下信息:
SYS@anqing2(rac2)> set autot trace statistics
SYS@anqing2(rac2)> select * from ta,tb where ta.id=tb.id and ta.id <10;
9 rows selected.
Statistics
----------------------------------------------------------
5 recursive calls
0 db block gets
2081 consistent gets
0 physical reads
0 redo size
695 bytes sent via SQL*Net to client
400 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
9 rows processed
关于执行计划,参考我的Blog:
Oracle Explain Plan
http://blog.csdn.net/tianlesoftware/archive/2010/08/20/5827245.aspx
官网对recursive calls 的解释如下:
Recursive Calls: Number of recursive calls generated at both the user and system level.
Oracle Database maintains tables used for internal processing. When it needs to change these tables, Oracle Database generates an internal SQL statement, which in turn generates a recursive call. In short, recursive calls are basically SQL performed on behalf of your SQL. So, if you had to parse the query, for example, you might have had to run some other queries to get data dictionary information. These would be recursive calls. Space management, security checks, calling PL/SQL from SQL—all incur recursive SQL calls。
MOS 上的说明
Sometimes to execute a SQL statement issued by a user, Oracle must issue additional statements. Such statements are called 'recursive calls' or 'recursive SQL statements'. For example, if you insert a row into a table that does not have enough space to hold that row, Oracle makes recursive calls to allocate the space dynamically.
Recursive calls are also generated when data dictionary information is not available in the data dictionary cache and must be retrieved from disk. If recursive calls occur while the SQL trace facility is enabled, TKPROF produces statistics for the recursive SQL statements and clearly marks them as recursive SQL statements in the output file.
Note that the statistics for a recursive SQL statement are included in the listing for that statement, not in the listing for the SQL statement that caused the recursive call. So when you are calculating the total resources required to process a SQL statement, you should consider the statistics for that statement as well as those for recursive calls caused by that statement.
IBM 的一篇文档上说明如下:
http://publib.boulder.ibm.com/tividd/td/ITMD/SC23-4724-00/en_US/HTML/oraclepac510rg59.htm
Monitors the following information:
1.Recursive Calls -- The number of recursive calls since the instance was created
2.User Calls -- The number of user calls since the instance was created
3.Recursive Call Rate (Interval) -- The number of new recursive calls per second
4.Recursive To User Call Ratio -- The number of recursive calls compared to the number of user calls
A user call is an SQL statement that is executed at the request of the user.
A recursive call occurs when one SQL statement requires the execution of a further separate SQL statement. A continued increase in the reported figure indicates poor or decreasing system performance. Some recursive activity is unavoidable.
Recursive calls can be generated by the following activities:
(1)An object requiring an additional extent for storage (dynamic extension)
(2)Misses on the dictionary cache
(3)Firing of database triggers
(4)DDL statements
(5)Execution of SQL statements within stored procedures, packages, functions, and anonymous PL/SQL blocks
(6)Enforcement of referential integrity constraints
If Oracle is making an inordinate number of recursive calls, try to determine which of the previously listed activities is causing most of the recursive calls. Run the application through TKPROF with EXPLAIN PLAN to see what the application is doing.
Also, monitor the number of extents in the database to see if there is noticeable dynamic extension. If the recursive calls are caused by dynamic extension, you can reduce the number of calls by allocating larger extents to the relevant objects. A dictionary cache that is too small can also cause recursive calls.
总结一下:
当执行一条SQL语句时,产生的对其他SQL语句的调用,这些额外的语句称之为''recursive calls''或''recursive SQL statements''.
在IBM 的那片文档里讲了触发Recursive Call的6种情况:
如:
(1)我们做一条insert 时,没有足够的空间来保存row记录,Oracle 通过Recursive Call 来动态的分配空间。
(2)执行DDL语句时,ORACLE总是隐含的发出一些recursive SQL语句,来修改数据字典信息,以便成功的执行该DDL语句。
(3)当Shared Pool过小,data dictionary cache 也会相应的过小,没有足够的空间存储ORACLE的系统数据字典信息时,会发生Recursive calls,这些Recursive calls会将数据字典信息从硬盘读入内存中。
(4)存储过程、触发器内如果有SQL调用的话,也会产生recursive SQL。
Oracle Shared pool 详解
http://blog.csdn.net/tianlesoftware/archive/2011/06/22/6560956.aspx
在这些情况中,主要是对数据字典的查询,通常发生在第一次执行时,第二次执行一般可显著降低。递归需要消耗大量的资源,如果操作复杂,很容易出现问题!
二. Recursive Calls 的测试
在上面的说明提到数据字典查询,如果Data dictionary cache 过小,没有足够的空间来存放数据字典信息时,就会发生Recursive Calls,此时ORACLE会从硬盘读取数据字典信息,来完成相关的查询工作。
在这种情况下,可以将recursive calls理解为从磁盘读取数据字典的次数。
SYS@anqing2(rac2)> set autot trace stat
SYS@anqing2(rac2)> select * from dba_objects;
50256 rows selected.
Statistics
----------------------------------------------------------
8 recursive calls
0 db block gets
8826 consistent gets
0 physical reads
0 redo size
2541097 bytes sent via SQL*Net to client
37250 bytes received via SQL*Net from client
3352 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
50256 rows processed
SYS@anqing2(rac2)> select * from dba_objects;
50256 rows selected.
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
8824 consistent gets
0 physical reads
0 redo size
2541097 bytes sent via SQL*Net to client
37250 bytes received via SQL*Net from client
3352 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
50256 rows processed
在第一次查询dba_objects时,产生了8次recursive Call,第二次查询的时候,因为数据字典的信息信息已经放在cache里,所以第二次的recursive call 为0. 如果第二次也没有完全cache,那么也是会产生recursive call,但次数比第一次少。
查看 data dictionary cache 的命中率:
SYS@anqing2(rac2)> select sum(gets),sum(getmisses),(1-(sum(getmisses)/(sum(gets)+sum(getmisses)))) hitratio from v$rowcache;
SUM(GETS) SUM(GETMISSES) HITRATIO
---------- -------------- ----------
2475550 14453 .994195589
查看data dictionary cache 的大小:
SYS@anqing2(rac2)> select sum(sharable_mem) from v$sqlarea;
SUM(SHARABLE_MEM)
-----------------
17399859
分享到:
相关推荐
标题"Recursive_recursive_"和描述"Introduction to recursive programming"都指向了递归编程的主题,这是计算机科学中的一个核心概念。下面我们将深入探讨递归编程的基础、原理以及如何在实际编程中应用。 递归的...
postgre sql recursive sql. 在postgoresql 中使用recursive的脚本实现循环查询结果
In this book, hyperarithmetic theory is developed at length and used to lift classical recursion theory from integers to recursive ordinals (metarecursion). Two further liftings are then made, first ...
"mkdir-recursive" 是一个专门针对这种情况的开源库,它提供了在前端环境中实现递归创建或删除目录的功能,无论是异步还是同步方式。这个库对于那些需要在用户浏览器上进行本地存储或者模拟服务器端文件操作的应用...
本资源"recursive.rar"包含了关于如何将递归函数转换为非递归函数的方法,以及使用Python语言编写的示例代码,旨在帮助开发者理解这一转换过程,并对比不同实现方式的执行效率。 递归函数的主要特点在于它会将大...
`laravel-recursive-collection`是一个专为解决此类问题设计的包,它扩展了Laravel的内置集合(Collections)类,允许开发者以更优雅的方式对嵌套数组和关联数组进行迭代和转换,生成嵌套的集合对象。 一、Laravel...
Theory.of.Recursive.Functions
这就是`recursive-watch`库的作用,它提供了一个最小化的递归文件监视器,可以监测指定目录及其子目录下的文件变化。 **一、安装与使用** 在你的项目中,你可以通过npm(Node.js的包管理器)来安装`recursive-...
Introduction to Recursive Programming 英文azw3 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
Introduction to Recursive Programming 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
Recursive Methods in Economic Dynamics.Stokey.Lucas
Recursive Mathematics - Volume 1 Recursive Model TheoryRecursive Mathematics - Volume 1 Recursive Model TheoryRecursive Mathematics - Volume 1 Recursive Model Theory
Recursive Projection Clustering(RPC)是一种在机器学习领域中用于数据聚类的算法,它结合了投影和递归的思想,旨在发现数据集中的潜在结构。RPC 方法以其独特的方式处理高维数据,试图找到能够最好地区分不同类别...
"Bookflare.net"文本文件和URL可能包含更多关于获取和阅读这本书的指南。 通过对超级递归算法的深入学习和实践,C++程序员可以扩展他们的工具箱,更好地应对那些需要动态自我调整和递归深度的复杂计算任务。
本压缩包文件"Recursive-Gaussian-filter.rar_recursive gaussian"包含了基于OpenCV库实现的递归高斯滤波器代码,文件名为"opencv.cpp"。 首先,我们要理解高斯滤波器的工作原理。高斯滤波器是基于二维高斯函数的...
Recursion is one of the most fundamental concepts in computer science and a key programming technique that, similarly to iteration, allows computations to be carried out repeatedly
In this book, hyperarithmetic theory is developed at length and used to lift classical recursion theory from integers to recursive ordinals (metarecursion). Two further liftings are then made, first ...
在图像插帧领域中对真实运动向量进行估计的算法,此算法较为经典,3DRS
### 递归程序在复合分布计算中的应用 #### 引言与背景 本文探讨了复合分布的计算问题,尤其关注计数分布具有特定性质的情况,即连续概率比可表示为两个多项式的比值。该文由Ole Hesselager撰写,发表于1994年的...