`

Oracle Recursive Calls 说明

阅读更多

.  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


 

官网对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:

       1An object requiring an additional extent for storage (dynamic extension)

       2Misses on the dictionary cache

       3Firing of database triggers  

       4DDL statements

       5Execution of SQL statements within stored procedures, packages, functions, and anonymous PL/SQL blocks

       6Enforcement 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 Call6种情况:  

       如:

       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

 

 

       在这些情况中,主要是对数据字典的查询,通常发生在第一次执行时,第二次执行一般可显著降低。递归需要消耗大量的资源,如果操作复杂,很容易出现问题!

 

 

.  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时,产生了8recursive 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;

分享到:
评论

相关推荐

    Oracle中explain_plan的用法

    0 recursive calls 2 db block gets 30 consistent gets 0 physical reads 0 redo size 2598 bytes sent via SQL*Net to client 503 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 0...

    oracle执行计划详解

    2. Recursive SQL 概念:有时为了执行用户发出的一个 SQL 语句,Oracle 必须执行一些额外的语句,我们将这些额外的语句称之为 ''recursive calls'' 或 ''recursive SQL statements''。这些语句是 Oracle 内部执行的...

    ORACLE执行计划和SQL调优.ppt

    这些语句称为Recursive calls或Recursive SQL statements。 3. Row Source and Predicate概念:Row Source是指查询中由上一操作返回的符合条件的行的集合。Predicate是指一个查询中的WHERE限制条件。 4. Driving ...

    Oracle性能分析——使用set_autotrace_on和set_timing_on来分析select语句的性能.doc

    统计信息展示了 SQL 语句的执行情况,例如recursive calls、db block gets、consistent gets、physical reads 等;trace 信息展示了 SQL 语句的执行过程。 在分析 autotrace 结果时,需要关注的点包括: * 运行...

    oracle怎么查看执行计划

    0 recursive calls 4 db block gets 28 consistent gets 0 physical reads 0 redo size 1207 bytes sent via SQL*Net to client 424 bytes received via SQL*Net from client 2 SQL*...

    ORACLE执行计划和SQL调优知识概述.pptx

    Recursive SQL 概念是指为了执行用户发出的一个 SQL 语句,ORACLE 必须执行一些额外的语句,这些额外的语句称之为‘recursive calls’ 或‘recursive SQL statements’。Row Source 和 Predicate 是查询中的两个重要...

    SQL执行计划简单分析

    Recursive Calls 是指 Oracle 数据库内部执行的 SQL 语句,这些语句是为了满足当前 SQL 语句的执行所需的。例如,在执行一个 SELECT 语句时,Oracle 数据库需要读取数据字典信息,以确定表的结构和索引信息。这将...

    Oracle培训讲义(性能分析与调整).docx

    - **recursive calls**: 表示递归调用次数,如果该值过高,可能表明存在硬解析(hard parse)问题。 - **db block gets**: 数据块获取次数,反映从数据文件读取的数据块数量。 - **consistent gets**: 一致性读取次数...

    oracle AWR报告解读

    - **User calls**、**Parses**、**Hard parses**和**Sorts**:展示了SQL语句的执行次数,硬解析次数较少意味着解析效率高。 - **Logons**和**Transactions**:登录和事务的数量,如果Logons频繁,可能暗示并发用户...

    Oracle AWR 报告分析实例讲解.docx

    如案例所示,平均每个CPU耗时1.4分钟,CPU利用率仅为2%,说明系统整体压力较小。 3. **Snapshot Interval**:快照间隔是指AWR收集数据的时间间隔。正确的快照间隔对于准确评估性能至关重要。如果快照周期不在数据库...

    OracleAWR报告分析实例讲解.pdf

    3. **Load Profile**: 这部分展示了数据库的负载概况,包括每秒和每事务的Redo size、Logical reads、Block changes、Physical reads和writes、User calls、Parses、Hard parses、Sorts、Logons以及Executes。...

    Oracle_AWR_报告分析实例讲解.docx

    在这种情况下,CPU利用率仅为约2%,这说明系统的整体压力较小。 对于批量处理系统而言,数据库的工作负载往往集中在特定的时间段内。因此,如果AWR快照收集的时间不在这个高峰期或者快照周期过长,那么所得到的数据...

    Oracle_AWR_报告分析实例讲解

    - **Recursive Call %**: 递归调用占所有操作的比率 - **Rollback per transaction %**: 每事务的回滚率 - **Rows per Sort**: 每次排序的行数 负载概况中的数据需要与基线数据进行比较才有更多意义。例如,...

    【Oracle性能调优】OracleStatspack报告中各项指标含义详解[归类].pdf

    Oracle Statspack 报告指标...35. Recursive Call Percent(递归操作占所有操作的比率) 递归操作占所有操作的比率是指递归操作占所有操作的百分比。 36. Rollback/T(回滚事务数) 回滚事务数是指回滚事务的次数。

    ORACLE资源详解

    - **User calls**:每秒/每事务用户调用次数。这反映了用户对数据库的请求频率。 - **Parses**:SQL解析次数。这包括快速解析(fast parse)、软解析(soft parse)和硬解析(hard parse)。软解析次数过高可能意味着应用...

    awr报告详解

    6. **User calls**:表示每秒/每事务用户调用的次数。这反映了用户活动的密集程度。 7. **Parses**:表示SQL解析的次数,包括快速解析(fast parse)、软解析(soft parse)和硬解析(hard parse)。其中硬解析次数过多...

Global site tag (gtag.js) - Google Analytics