[bbk4949]第64集 第7章 - 数据库的维护 01

Oracle Optimizer:Overview

The Oracle optimizer determines the most efficient execution plan and is the most important step in the processing of any SQL statement.

The Optimizer

  • Evaluates expressions and conditions
  • Uses object and system statistics
  • Decides how to access the data
  • Decides how to join tables
  • Determines the most efficient path

Optimizer Statistics

Optimizer statistics are:

  • A snapshot at a point in time
  • Persistent across instance restarts
  • Collected automatically
SQL> select count(*) from frx_oa_dict;

  COUNT(*)
----------
       480

SQL> select num_rows from dba_tables
  2  where owner='ARCER' and table_name = 'FRX_OA_DICT';

  NUM_ROWS
----------
       479

上述SQL语句说明,优化器的统计数据与实际表中的数据,有可能存在差距的.而oracle判断执行计划的依据则是数据字典中的统计数据.

每个语句就是一个游标.

Using the Manage Optimizer Statistics Page

Gathering Optimizer Statistics Manually

Preferences(首选项) for Gathering Statistics

posted @ 2013-05-30 13:39  ArcerZhang  阅读(136)  评论(0编辑  收藏  举报