WEB开发网
开发学院数据库Oracle Oracle数据库中可移动的表空间详解 阅读

Oracle数据库中可移动的表空间详解

 2007-05-12 12:27:09 来源:WEB开发网   
核心提示: set serveroutput on size 999999set long 999999select dbms_sqltune.report_tuning_task ('FOLIO_COUNT') from dual;显示的输出结果仔细查看这些建议;顾问说您可以通过在
  set serveroutput on size 999999
  set long 999999
  select dbms_sqltune.report_tuning_task ('FOLIO_COUNT') from dual;

显示的输出结果仔细查看这些建议;顾问说您可以通过在 OLD_ACCOUNT_NO 列上创建一个索引来改进性能。更佳的是,如果创建索引,顾问计算了查询成本,从而使潜在的节省量变得更加可定义、更加具体。

当然,考虑到本示例的简单性,通过手动检查也能得到这种结论。但是,可以想象出该工具对于那些更复杂的查询十分有用,因为对这些查询执行手动检查也许是不可能的或不实际的。

查询重构

假定查询更复杂:

  select account_no from accounts a
  where account_name = 'HARRY'
  and sub_account_name not in
  ( select account_name from accounts
  where account_no = a.old_account_no and status is not null);

顾问建议如下:

  1- Restructure SQL finding (see plan 1 in explain plans section)
  ----------------------------------------------------------------
  The optimizer could not unnest the subquery
  at line ID 1 of the execution
  plan.
  
  Recommendation
   --------------
  Consider replacing "NOT IN" with "NOT EXISTS" or ensure
  that columns used on both sides of the "NOT IN" operator
  are declared "NOT NULL" by adding
  either "NOT NULL" constraints or "IS NOT NULL" predicates.
  
  Rationale
   ---------
  A "FILTER" operation can be very expensive because it
  evaluates the subquery for each row in the parent
  query.The subquery, when unnested can
  drastically improve the execution time because
  the "FILTER" operation is
  converted into a join.Be aware that "NOT IN"
  and "NOT EXISTS" might
  produce different results for "NULL" values.

这一次顾问不会建议任何结构上的更改(如索引),但会通过用 NOT EXISTS 取代 NOT IN的方式很聪明地猜测到调整查询的正确方式。由于两种构造相似但不相同,顾问给出了这种改变的基本原理,并把决定权留给 DBA 或应用程序开发人员,由他们决定该建议是否对环境有效。

上一页  1 2 3 4 5 

Tags:Oracle 数据库 移动

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接