0) Generate the diff plan report
We have sql_id gu7rvn4s4rb0m, and 2 child cursors 0 and 2
variable v clob
set serveroutput on
set autoprint on
set lines 150
exec :v := dbms_xplan.diff_plan_cursor('gu7rvn4s4rb0m', 0, 2);
http://stads59.us.oracle.com:8080/orarep/plandiff/all?task_id=119&format=html&method=qbreg
PL/SQL procedure successfully completed.
V
--------------------------------------------------------------------------------
TASK_119
Display the report, 2 options:
1) Display the report via XML DB
--open http port if needed, if you are on test/dev environment
exec dbms_xdb.SETHTTPPORT(8080);
--replacing url by local hostname
http://<db host name>:8080/orarep/plandiff/all?task_id=119&format=html&method=qbreg
2) Display in sqlplus
--report in text format, or replace format=html or format=xml
set define off;
set long 999999999
set pagesize 3000
select dbms_report.get_report(
'/orarep/plandiff/all?task_id=119&format=text&method=qbreg')
from dual;
DBMS_REPORT.GET_REPORT('/ORAREP/PLANDIFF/ALL?TASK_ID=119&FORMAT=TEXT&METHOD=QBRE
--------------------------------------------------------------------------------
General Information
-------------------------------------------------------------------------------
Task Information: Workload Information:
------------------------------------- -------------------------------------
Task Name : TASK_119
Task Owner : SYS
Description : diff_plan_cursor
Report Details: SQL Plan Comparison Query Block Diff
------------------------------------------------
| Query Block | SQL Plan 1 | SQL Plan 2 | Diff |
------------------------------------------------
Join Order Diff
-----------------------------------------
| Query Block | SQL Plan 1 | SQL Plan 2 |
-----------------------------------------
Join Method Diff
---------------------------------------------------------
| Query Block | Table to Join | SQL Plan 1 | SQL Plan 2 |
---------------------------------------------------------
| SEL$1 | "T2"@"SEL$1" | HASH | MERGE |
---------------------------------------------------------
Plan Id : 325
Plan Hash Value : 2795996736
----------------------------------------
| Id | Operation | Name |
----------------------------------------
| 0 | SELECT STATEMENT | |
| * 1 | HASH JOIN | |
| 2 | TABLE ACCESS FULL | TEST100 |
| 3 | TABLE ACCESS FULL | TEST100 |
----------------------------------------
Predicate Information (identified by operation id):
------------------------------------------
* 1 - access("T1"."ID"="T2"."ID")
Plan Id : 326
Plan Hash Value : 216926072
-----------------------------------------
| Id | Operation | Name |
-----------------------------------------
| 0 | SELECT STATEMENT | |
| 1 | MERGE JOIN | |
| 2 | INDEX FULL SCAN | TEST100_I |
| * 3 | SORT JOIN | |
| 4 | INDEX FULL SCAN | TEST100_I |
-----------------------------------------
Predicate Information (identified by operation id):
------------------------------------------
* 3 - access("T1"."ID"="T2"."ID")
* 3 - filter("T1"."ID"="T2"."ID")
-----------------------------------------------------------------
| Diff | Transformation | SQL Plan 1 | SQL Plan 2 | Query block |
-----------------------------------------------------------------
| * | . PARSER | Yes | Yes | . SEL$1 |
-----------------------------------------------------------------
We have sql_id gu7rvn4s4rb0m, and 2 child cursors 0 and 2
variable v clob
set serveroutput on
set autoprint on
set lines 150
exec :v := dbms_xplan.diff_plan_cursor('gu7rvn4s4rb0m', 0, 2);
http://stads59.us.oracle.com:8080/orarep/plandiff/all?task_id=119&format=html&method=qbreg
PL/SQL procedure successfully completed.
V
--------------------------------------------------------------------------------
TASK_119
Display the report, 2 options:
1) Display the report via XML DB
--open http port if needed, if you are on test/dev environment
exec dbms_xdb.SETHTTPPORT(8080);
--replacing url by local hostname
http://<db host name>:8080/orarep/plandiff/all?task_id=119&format=html&method=qbreg
2) Display in sqlplus
--report in text format, or replace format=html or format=xml
set define off;
set long 999999999
set pagesize 3000
select dbms_report.get_report(
'/orarep/plandiff/all?task_id=119&format=text&method=qbreg')
from dual;
DBMS_REPORT.GET_REPORT('/ORAREP/PLANDIFF/ALL?TASK_ID=119&FORMAT=TEXT&METHOD=QBRE
--------------------------------------------------------------------------------
General Information
-------------------------------------------------------------------------------
Task Information: Workload Information:
------------------------------------- -------------------------------------
Task Name : TASK_119
Task Owner : SYS
Description : diff_plan_cursor
Report Details: SQL Plan Comparison Query Block Diff
------------------------------------------------
| Query Block | SQL Plan 1 | SQL Plan 2 | Diff |
------------------------------------------------
Join Order Diff
-----------------------------------------
| Query Block | SQL Plan 1 | SQL Plan 2 |
-----------------------------------------
Join Method Diff
---------------------------------------------------------
| Query Block | Table to Join | SQL Plan 1 | SQL Plan 2 |
---------------------------------------------------------
| SEL$1 | "T2"@"SEL$1" | HASH | MERGE |
---------------------------------------------------------
Plan Id : 325
Plan Hash Value : 2795996736
----------------------------------------
| Id | Operation | Name |
----------------------------------------
| 0 | SELECT STATEMENT | |
| * 1 | HASH JOIN | |
| 2 | TABLE ACCESS FULL | TEST100 |
| 3 | TABLE ACCESS FULL | TEST100 |
----------------------------------------
Predicate Information (identified by operation id):
------------------------------------------
* 1 - access("T1"."ID"="T2"."ID")
Plan Id : 326
Plan Hash Value : 216926072
-----------------------------------------
| Id | Operation | Name |
-----------------------------------------
| 0 | SELECT STATEMENT | |
| 1 | MERGE JOIN | |
| 2 | INDEX FULL SCAN | TEST100_I |
| * 3 | SORT JOIN | |
| 4 | INDEX FULL SCAN | TEST100_I |
-----------------------------------------
Predicate Information (identified by operation id):
------------------------------------------
* 3 - access("T1"."ID"="T2"."ID")
* 3 - filter("T1"."ID"="T2"."ID")
-----------------------------------------------------------------
| Diff | Transformation | SQL Plan 1 | SQL Plan 2 | Query block |
-----------------------------------------------------------------
| * | . PARSER | Yes | Yes | . SEL$1 |
-----------------------------------------------------------------
Комментариев нет:
Отправить комментарий