Oracle Implementation Plan Explanation (i) ____oracle

Source: Internet
Author: User

Understanding Oracle Execution Plans is the first step in optimization, let's start with the example below.

The following supplementary content

1. Create Test table
[SQL] view plain copy sql> create table t as Select 1 id,object_name from Dba_objects;       Table created sql> update t set id=99 where rownum=1;       1 row updated sql> commit;       Commit Complete sql> CREATE index t_ind on t (ID); Index created

Oracle Optimizer: Rbo and CBO two kinds, from the oracle10g start optimizer has abandoned the Rbo, the following illustration shows how the CBO is probably

[SQL]  View Plain  copy sql>  select /*+dynamic_sampling (t 0)  */* from  t where id=1;      50819 rows selected.          execution plan  ----------------------------------------------------------   plan hash value: 1376202287     -------------------------------------------- -----------------------------------------   | id  | operation                    | name   | Rows  | Bytes | Cost  (%CPU) | time      |  -------------------------------------------------------------------------------------    |   0 | select statement             |       |   195 | 15405 |     51    (0) | 00:00:01 |   |   1 |   TABLE ACCESS BY INDEX ROWID| T     |    195 | 15405 |    51    (0) | 00:00:01 |    |*  2 |   index range scan           | T_IND |    78 |        |    50    (0) | 00:00:01 |  ---------------- ---------------------------------------------------------------------      predicate  information  (identified by operation id):  ------------------------------------- --------------&NBsp;        2 - access ("ID" =1)   

The

       T table has not been analyzed, suggesting that/*+dynamic_sampling (T 0) */* is designed to allow the CBO to get the actual data in the table through dynamic sampling, At this point the CBO can only guess the data in the table based on the very limited information in the T table (such as the number of extents in the table, the number of data blocks). As you can see from the results, the CBO guessed that there are 195 id=1 in the table, which is a very small value for the total number of tables, so the CBO chooses the index rather than the full table scan.
      The actual situation looks like this:
[SQL]   View plain  copy sql>  Select * from  t where

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.