The execution plan
I get two execution plans in the following:
a.
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=1 Card=1 Bytes=35262
1 0 SORT (AGGREGATE)
2 1 BITMAP CONVERSION (COUNT)
3 2 BITMAP INDEX (SINGLE VALUE) OF 'IDXWIPCURRENTFLG'
b.
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=17629
8)
1 0 SORT (AGGREGATE)
2 1 BITMAP CONVERSION (COUNT)
3 2 BITMAP INDEX (RANGE SCAN) OF 'IDXWIPCURRENTFLG'
How to understand 'Cost' and 'Card'?
Which execution is more efficient?
Hi,
Card means Cardinality.
The Cost is a mesure that have no unity but be sure that an explain plan with a lower cost means that the SQL statement will be quicker.
Fred
Similar Messages
-
Error in DAC 7.9.4 while building the execution plan
I'm getting Java exception EXCEPTION CLASS::: java.lang.NullPointerException while building the execution plan. The parameters are properly generated.
Earlier we used to get the error - No physical database mapping for the logical source was found for :DBConnection_OLAP as used in QUERY_INDEX_CREATION(DBConnection_OLAP->DBConnection_OLAP)
EXCEPTION CLASS::: com.siebel.analytics.etl.execution.NoSuchDatabaseException
We resolved this issue by using the in built connection parameters i.e. DBConnection_OLAP. This connection parameter has to be used because the execution plan cannot be built without OLAP connection.
We are not using 7.9.4 OLAP data model since we have highly customized 7.8.3 OLAP model. We have imported 7.8.3 tables in DAC.
We have created all the tasks with syncronzation method, created the task group and subject area. We are using in built DBConnection_OLAP and DBConnection_OLTP parameters and pointed them to relevant databases.
system set up -
OBI DAC server - windows server
Informatica server and repository sever 7.1.4 - installed on local machine and
provied PATH variables.
IS this problem regarding the different versions i.e. we are using OBI DAC 7.9.4 and underlying data model is 7.8.3?
Please help,
Thanks and regards,
AshishHi,
Can anyone help me here as I have stuck with the following issue................?
I have created a command task in workflow at Informatica that will execute a script in Unix to purge chache at OBIEE.But I want that workflow to be added as a task in DAC at already existing Plan and should be run at the last one whenever the Incremental load happens.
I created a Task in DAC with name of Workflow like WF_AUTO_PURGE and added that task as following task at Execution mode,The problem here is,I want to build that task after adding to the plan.I some how stuck here , When I try to build the task It is giving following error !!!!!
MESSAGE:::Error while loading pre post steps for Execution Plan. CompleteLoad_withDeleteNo physical database mapping for the logical source was found for :DBConnection_INFA as used in WF_AUTO_PURGE (DBConnection_INFA->DBConnection_INFA)
EXCEPTION CLASS::: com.siebel.analytics.etl.execution.ExecutionPlanInitializationException
com.siebel.analytics.etl.execution.ExecutionPlanDesigner.design(ExecutionPlanDesigner.java:1317)
com.siebel.analytics.etl.client.util.tables.DefnBuildHelper.calculate(DefnBuildHelper.java:169)
com.siebel.analytics.etl.client.util.tables.DefnBuildHelper.calculate(DefnBuildHelper.java:119)
com.siebel.analytics.etl.client.view.table.EtlDefnTable.doOperation(EtlDefnTable.java:169)
com.siebel.etl.gui.view.dialogs.WaitDialog.doOperation(WaitDialog.java:53)
com.siebel.etl.gui.view.dialogs.WaitDialog$WorkerThread.run(WaitDialog.java:85)
::: CAUSE :::
MESSAGE:::No physical database mapping for the logical source was found for :DBConnection_INFA as used in WF_AUTO_PURGE(DBConnection_INFA->DBConnection_INFA)
EXCEPTION CLASS::: com.siebel.analytics.etl.execution.NoSuchDatabaseException
com.siebel.analytics.etl.execution.ExecutionParameterHelper.substitute(ExecutionParameterHelper.java:208)
com.siebel.analytics.etl.execution.ExecutionParameterHelper.parameterizeTask(ExecutionParameterHelper.java:139)
com.siebel.analytics.etl.execution.ExecutionPlanDesigner.handlePrePostTasks(ExecutionPlanDesigner.java:949)
com.siebel.analytics.etl.execution.ExecutionPlanDesigner.getExecutionPlanTasks(ExecutionPlanDesigner.java:790)
com.siebel.analytics.etl.execution.ExecutionPlanDesigner.design(ExecutionPlanDesigner.java:1267)
com.siebel.analytics.etl.client.util.tables.DefnBuildHelper.calculate(DefnBuildHelper.java:169)
com.siebel.analytics.etl.client.util.tables.DefnBuildHelper.calculate(DefnBuildHelper.java:119)
com.siebel.analytics.etl.client.view.table.EtlDefnTable.doOperation(EtlDefnTable.java:169)
com.siebel.etl.gui.view.dialogs.WaitDialog.doOperation(WaitDialog.java:53)
com.siebel.etl.gui.view.dialogs.WaitDialog$WorkerThread.run(WaitDialog.java:85)
Regards,
Arul
Edited by: 869389 on Jun 30, 2011 11:02 PM
Edited by: 869389 on Jul 1, 2011 2:00 AM -
Unable to get the execution plan when using dbms_sqltune (11gR2)
Hi,
Database version: 11gR2
I have a user A that is granted privileges to execute dbms_sqltune.
I can create a task, excute it and run the report.
But, when I run the report I get the following error:
SQL> show user
USER is "A"
SQL> set long 10000 longchunksize 10000 linesize 200 pagesize 000
select dbms_sqltune.report_tuning_task(task_name => 'MYTEST') from dual;SQL>
GENERAL INFORMATION SECTION
Tuning Task Name : MYTEST
Tuning Task Owner : A
Workload Type : Single SQL Statement
Scope : COMPREHENSIVE
Time Limit(seconds): 1800
Completion Status : COMPLETED
Started at : 05/15/2013 11:53:22
Completed at : 05/15/2013 11:53:23
Schema Name: SYSMAN
SQL ID : gjm43un5cy843
SQL Text : SELECT SUM(USED), SUM(TOTAL) FROM (SELECT /*+ ORDERED */
SUM(D.BYTES)/(1024*1024)-MAX(S.BYTES) USED,
SUM(D.BYTES)/(1024*1024) TOTAL FROM (SELECT TABLESPACE_NAME,
SUM(BYTES)/(1024*1024) BYTES FROM (SELECT /*+ ORDERED USE_NL(obj
tab) */ DISTINCT TS.NAME FROM SYS.OBJ$ OBJ, SYS.TAB$ TAB,
SYS.TS$ TS WHERE OBJ.OWNER# = USERENV('SCHEMAID') AND OBJ.OBJ# =
TAB.OBJ# AND TAB.TS# = TS.TS# AND BITAND(TAB.PROPERTY,1) = 0 AND
BITAND(TAB.PROPERTY,4194400) = 0) TN, DBA_FREE_SPACE SP WHERE
SP.TABLESPACE_NAME = TN.NAME GROUP BY SP.TABLESPACE_NAME) S,
DBA_DATA_FILES D WHERE D.TABLESPACE_NAME = S.TABLESPACE_NAME
GROUP BY D.TABLESPACE_NAME)
ERRORS SECTION
- ORA-00942: table or view does not exist
SQL>
It seems there a missing privileg for dislaying the execution plan.
As a workaround, this is solved by granting select any dictionay (which I don't want) to the user A.
Does someone have an idea about what privilege is missing?
Kind Regards.Hi,
SELECT ANY DICTIONARY system privilege provides access to SYS schema objects only => which you are using as workaround
SELECT_CATALOG_ROLE provides access to all SYS views only.==> Safe option
SQL> grant SELECT ANY DICTIONARY to test;
Grant succeeded.
SQL> conn test/test
Connected.
SQL> select count(*) from sys.obj$;
COUNT(*)
13284
SQL> conn /as sysdba
Connected.
SQL> revoke SELECT ANY DICTIONARY from test;
Revoke succeeded.
SQL> grant SELECT_CATALOG_ROLE to test;
Grant succeeded.
SQL> conn test/test
Connected.
SQL> select count(*) from sys.obj$;
select count(*) from sys.obj$
ERROR at line 1:
ORA-00942: table or view does not existHTH -
How to capture the execution plan for a query
HI All,
Can anyone please help me in finding out the command to capture the execution plan for a query.
Execution plan for select * from EMP where <Condtions>
it is getting executed successfully but i need to get the proper execution plan for the same.
Thanks971830 wrote:
i want to know where execution plan gets generated??
in PMON of server process or in shared pool??
i know that optimixer create execution plan..It is stored in Library Cache (present inside Shared Pool ).
select * from v$sql_plan;An absolute beautiful white paper :
Refer this -- www.sagelogix.com/sagelogix/SearchResults/SAGE015052
Also -- http://www.toadworld.com/KNOWLEDGE/KnowledgeXpertforOracle/tabid/648/TopicID/XPVSP/Default.aspx
HTH
Ranit B. -
How i can find the execution plan
how i can find the execution plan for a quesry , and how i can compare two execution plan
Mohan,
Just create a table as follows
CREATE TABLE T1 (STATEMENT_ID VARCHAR2(30),TIMESTAMP DATE,OPERATION VARCHAR2(30),
OPTIONS VARCHAR2(30),OBJECT_NAME VARCHAR2(30),COST NUMBER(38),
ID NUMBER(38),PARENT_ID NUMBER(38), OBJECT_NODE VARCHAR2(128),
OBJECT_OWNER VARCHAR2(30),OBJECT_INSTANCE NUMBER(38),OBJECT_TYPE VARCHAR2(30),
OPTIMIZER VARCHAR2(255),SEARCH_COLUMNS NUMBER,POSITION NUMBER(38),
PARTITION_START VARCHAR2(255),PARTITION_STOP VARCHAR2(255),PARTITION_ID NUMBER(38),
CARDINALITY NUMBER(38),BYTES NUMBER(38),OTHER_TAG VARCHAR2(255),
OTHER LONG,REMARKS VARCHAR2(80),DISTRIBUTION VARCHAR2(30)
Now use the sql statements as
> EXPLAIN PLAN INTO T1 FOR (SELECT * FROM EMP);
> Select * from T1
this should do the job . . .
Regards,
K.T. Gandhi Karuna -
Tool to find the execution plan of a SQL query
Hi,
I new to Oracle. I come from the SQL Server world.
I would like to know what tool(s) should I use to identify the execution plan for a SQL statement and to see if a query is missing indices.
Thanks,
PaulUse SQL*PLUS.
SQL> select dummy from dual;
D
X
SQL> set autotrace on explain
SQL> r
1* select dummy from dual
D
X
Execution Plan
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=2 Card=1 Bytes=2)
1 0 TABLE ACCESS (FULL) OF 'DUAL' (TABLE) (Cost=2 Card=1 Bytes
=2)
SQL> set autot off
SQL> explain plan for select dummy from dual;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 1157671242
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 2 | 2 (0)| 00:00:01 |
| 1 | TABLE ACCESS FULL| DUAL | 1 | 2 | 2 (0)| 00:00:01 |
8 rows selected.
SQL> disconnect
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining options
SQL> -
Tkprof not showing the Execution Plan for Statement
Hi all
using oracle 9i release 2
I have issued the following statements
alter session set sql_trace
alter session set events '10046 trace name context forever, level 12';
--then executed a pl-sql procedure
after reading the traceout outfile it shows the Execution plan for statements directly wirtten under begin and end block and doesnot displays the plan for the statements written like this
procedure a is
cursor b is
select ename,dname from dept a,emp b
where a.deptno=b.deptno;
begin
for x in a loop --plan not found but stats are written
select ename into v_ename from emp where empno=300; --does show the plan+stats
end;
what I am missing to get the actual plan in trace output file
thanks in advanceYou have to exit sql*plus after running the procedure, example tkprof is below:
declare
cursor c is
select ename, dname
from emp, dept
where emp.deptno = dept.deptno;
begin
for v_x in c
loop
dbms_output.put_line(v_x.ename || ' ' ||v_x.dname);
end loop;
end;
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.06 0 0 0 1
Fetch 0 0.00 0.00 0 0 0 0
total 2 0.00 0.06 0 0 0 1
Misses in library cache during parse: 0
Optimizer goal: CHOOSE
Parsing user id: 68
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 1 0.00 0.00
SQL*Net message from client 1 0.00 0.00
SELECT ENAME, DNAME
FROM
EMP, DEPT WHERE EMP.DEPTNO = DEPT.DEPTNO
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 15 0.01 0.00 0 44 0 14
total 17 0.01 0.00 0 44 0 14
Misses in library cache during parse: 0
Optimizer goal: CHOOSE
Parsing user id: 68 (recursive depth: 1)
Rows Row Source Operation
14 NESTED LOOPS
14 TABLE ACCESS FULL EMP
14 TABLE ACCESS BY INDEX ROWID DEPT
14 INDEX UNIQUE SCAN DEPT_PK (object id 40350)
Best Regards
Krystian Zieja / mob -
Issue in pulling the execution plan from awrsqrpt report.
Hi All,
In my production database , recently we faced some performance issue in daily job and i like to pull the old execution plan of that particular job from awrsqrpt.sql report but i got below error.
Interesting information is i can able to generate the addm reports & awr reports between the same SNAP id's Why not AWRSQRPT report ???.
Version : Oracle 11gR2
Error :
+++++++++
Specify the SQL Id
~~~~~~~~~~~~~~~~~~
Enter value for sql_id: b9shw6uakgbdt
SQL ID specified: b9shw6uakgbdt
declare
ERROR at line 1:
ORA-20025: SQL ID b9shw6uakgbdt does not exist for this database/instance
ORA-06512: at line 22
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
Old history of SQL id :
++++++++++++++++++++
SQL> select distinct SNAP_ID,SESSION_ID,SESSION_SERIAL#,USER_ID, SQL_EXEC_START from dba_hist_active_sess_history where sql_id='b9shw6uakgbdt' order by SQL_EXEC_START;
SNAP_ID SESSION_ID SESSION_SERIAL# USER_ID SQL_EXEC_
13095 1026 23869 86 29-AUG-12
13096 1026 23869 86 29-AUG-12
13118 582 14603 95 30-AUG-12
13119 582 14603 95 30-AUG-12
13139 708 51763 95 30-AUG-12
13140 708 51763 95 30-AUG-12
13142 900 2897 86 31-AUG-12
13143 900 2897 86 31-AUG-12
13215 1285 62559 86 03-SEP-12
13216 1285 62559 86 03-SEP-12
13238 1283 9057 86 04-SEP-12
13239 1283 9057 86 04-SEP-12
ThanksHi,
Are you using a cluster database (RAC), and running this report on the wrong instance?
This report validates the SQL ID you specify against the dba_hist_sqlstat view, so check there if you have that SQL ID:
select dbid, instance_number, snap_id
from dba_hist_sqlstat
where sql_id='b9shw6uakgbdt';Regards.
Nelson -
What's the execution plan tell me?
Hey everyone,
I'm just looking at this execution plan and want to understand what it exactly tells me.. I could make a little sense of it. I would like someone to explain it to me please.
Here it is:
Predicate Information (identified by operation id):
4 - access("A"."ATHLETEID"="ATHLETEID")
5 - filter("CCODE"='AUS')
Note
- dynamic sampling used for this statement (level=2)
Statistics
32 recursive calls
0 db block gets
26289 consistent gets
0 physical reads
5664 redo size
23496 bytes sent via SQL*Net to client
936 bytes received via SQL*Net from client
49 SQL*Net roundtrips to/from client
2 sorts (memory)
0 sorts (disk)
717 rows processed ---> it has selected 717 tuples.
I know the last one but not the rest. Looking forward to a detailed answer on this.>
I'm just looking at this execution plan and want to understand what it exactly tells me.. I could make a little sense of it. I would like someone to explain it to me please.
>
Well you are the ONLY one looking at the plan because you didn't post it for us to look at.
Can't comment on something we can't see. -
How do you view the execution plan of a query?
I want to see if a particular index was used for a specific query....
Becareful. You are in the Forum of OBIEE. It's much more a database question.
You can read an plan with a lot of tool. Toad permit it and I assume that Sql Developer also must give it.
Otherwise, you can use the basic command of Oracle as explain plan :
http://gerardnico.com/wiki/database/oracle/explain_plan
Cheers
Nico -
Confusion in FILTER and SORT operations in the execution plan
Hi
I have been working on tuning of a sql query:
SELECT SUM(DECODE(CR_FLG, 'C', NVL(TOT_AMT, 0), 0)),
SUM(DECODE(CR_FLG, 'C', 1, 0)),
SUM(DECODE(CR_FLG, 'R', NVL(TOT_AMT, 0), 0)),
SUM(DECODE(CR_FLG, 'R', 1, 0)),
SUM(DECODE(CR_FLG, 'C', NVL(TOT_AMT, 0), -1 * NVL(TOT_AMT, 0))),
SUM(1)
FROM TS_TEST
WHERE SMY_DT BETWEEN TO_DATE(:1, 'DD-MM-YYYY') AND
TO_DATE(:1, 'DD-MM-YYYY');Table TS_TEST is range partitioned on smy_dt and there is an index on smy_dt column. Explain plan of the query is:
SQL> explain plan for SELECT SUM(DECODE(CR_FLG, 'C', NVL(TOT_AMT, 0), 0)),
2 SUM(DECODE(CR_FLG, 'C', 1, 0)),
3 SUM(DECODE(CR_FLG, 'R', NVL(TOT_AMT, 0), 0)),
4 SUM(DECODE(CR_FLG, 'R', 1, 0)),
5 SUM(DECODE(CR_FLG, 'C', NVL(TOT_AMT, 0), -1 * NVL(TOT_AMT, 0))),
6 SUM(1)
7 FROM TS_TEST
8 WHERE SMY_DT BETWEEN TO_DATE(:1, 'DD-MM-YYYY') AND
9 TO_DATE(:1, 'DD-MM-YYYY');
Explained.
SQL> @E
PLAN_TABLE_OUTPUT
Plan hash value: 766961720
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
| 0 | SELECT STATEMENT | | 1 | 14 | 15614 (1)| 00:03:08 | | |
| 1 | SORT AGGREGATE | | 1 | 14 | | | | |
|* 2 | FILTER | | | | | | | |
| 3 | TABLE ACCESS BY GLOBAL INDEX ROWID| T_TEST | 79772 | 1090K| 15614 (1)| 00:03:08 | ROWID | ROWID |
|* 4 | INDEX RANGE SCAN | I_SMY_DT | 143K| | 442 (1)| 00:00:06 | | |
Predicate Information (identified by operation id):
2 - filter(TO_DATE(:1,'DD-MM-YYYY')<=TO_DATE(:1,'DD-MM-YYYY'))
4 - access("SMY_DT">=TO_DATE(:1,'DD-MM-YYYY') AND "SMY_DT"<=TO_DATE(:1,'DD-MM-YYYY'))
17 rows selected.
SQL>I am not able to understand the FILTER & SORT operations. As there is an index on SMY_DT column, so index range scan is fine. But why a FILTER (Step no 2) and SORT (Step no 1) operation after that ?
Oracle version is 10.2.0.3 on AIX 5.3 64 bit.
Any other information required please let me know.
Regards,
Amardeep SidhuSort aggregate tells you that there was performed an aggregate operation which returns one row, in opposite to sort order by or hash group by which indicates you have grouping, and there more than one row can be returned.
SQL> SELECT SUM(comm) FROM emp;
SUM(COMM)
2200
Plan wykonywania
Plan hash value: 2083865914
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 2 | 3 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 2 | | |
| 2 | TABLE ACCESS FULL| EMP | 14 | 28 | 3 (0)| 00:00:01 |
SQL> SELECT AVG(comm) FROM emp;
AVG(COMM)
550
Plan wykonywania
Plan hash value: 2083865914
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 2 | 3 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 2 | | |
| 2 | TABLE ACCESS FULL| EMP | 14 | 28 | 3 (0)| 00:00:01 |
SQL> SELECT MIN(comm) FROM emp;
MIN(COMM)
0
Plan wykonywania
Plan hash value: 2083865914
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 2 | 3 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 2 | | |
| 2 | TABLE ACCESS FULL| EMP | 14 | 28 | 3 (0)| 00:00:01 |
SQL> SELECT deptno, SUM(comm) FROM emp GROUP BY deptno;
DEPTNO SUM(COMM)
30 2200
20
10
Plan wykonywania
Plan hash value: 4067220884
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 3 | 15 | 4 (25)| 00:00:01 |
| 1 | HASH GROUP BY | | 3 | 15 | 4 (25)| 00:00:01 |
| 2 | TABLE ACCESS FULL| EMP | 14 | 70 | 3 (0)| 00:00:01 |
SQL>Edited by: Łukasz Mastalerz on Jan 14, 2009 11:41 AM -
Error in DAC during build the execution plan !
MESSAGE:::
MERGE GRAPH EXCEPTION: Happens when two execution graphs are merged.
Cannot merge graphs as they contain common nodes.REGULAR, POST_ETL
EXCEPTION CLASS::: com.siebel.analytics.etl.graph.MergeGraphException
com.siebel.analytics.etl.graph.GraphUtils.mergeManagers(GraphUtils.java:1237)
com.siebel.analytics.etl.execution.ExecutionPlanDesigner.generateDependency(ExecutionPlanDesigner.java:1157)
com.siebel.analytics.etl.execution.ExecutionPlanDesigner.design(ExecutionPlanDesigner.java:1268)
com.siebel.analytics.etl.client.util.tables.DefnBuildHelper.calculate(DefnBuildHelper.java:169)
com.siebel.analytics.etl.client.util.tables.DefnBuildHelper.calculate(DefnBuildHelper.java:119)
com.siebel.analytics.etl.client.view.table.EtlDefnTable.doOperation(EtlDefnTable.java:169)
com.siebel.etl.gui.view.dialogs.WaitDialog.doOperation(WaitDialog.java:53)
com.siebel.etl.gui.view.dialogs.WaitDialog$WorkerThread.run(WaitDialog.java:85)the problem has solved
-
Multiple Executions Plans for the same SQL statement
Dear experts,
awrsqrpt.sql is showing multiple executions plans for a single SQL statement. How is it possible that one SQL statement will have multiple Executions Plans within the same AWR report.
Below is the awrsqrpt's output for your reference.
WORKLOAD REPOSITORY SQL Report
Snapshot Period Summary
DB Name DB Id Instance Inst Num Release RAC Host
TESTDB 2157605839 TESTDB1 1 10.2.0.3.0 YES testhost1
Snap Id Snap Time Sessions Curs/Sess
Begin Snap: 32541 11-Oct-08 21:00:13 248 141.1
End Snap: 32542 11-Oct-08 21:15:06 245 143.4
Elapsed: 14.88 (mins)
DB Time: 12.18 (mins)
SQL Summary DB/Inst: TESTDB/TESTDB1 Snaps: 32541-32542
Elapsed
SQL Id Time (ms)
51szt7b736bmg 25,131
Module: SQL*Plus
UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL,0) + NVL(ACCT_DR_BAL,
0)) FROM ACCT WHERE ACCT_TRN_DT = (:B1 ) AND TEST_ACC_NB = ACCT_ACC_NB(+)) WHERE
TEST_BATCH_DT = (:B1 )
SQL ID: 51szt7b736bmg DB/Inst: TESTDB/TESTDB1 Snaps: 32541-32542
-> 1st Capture and Last Capture Snap IDs
refer to Snapshot IDs witin the snapshot range
-> UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL,0) + NVL(AC...
Plan Hash Total Elapsed 1st Capture Last Capture
# Value Time(ms) Executions Snap ID Snap ID
1 2960830398 25,131 1 32542 32542
2 3834848140 0 0 32542 32542
Plan 1(PHV: 2960830398)
Plan Statistics DB/Inst: TESTDB/TESTDB1 Snaps: 32541-32542
-> % Total DB Time is the Elapsed Time of the SQL statement divided
into the Total Database Time multiplied by 100
Stat Name Statement Per Execution % Snap
Elapsed Time (ms) 25,131 25,130.7 3.4
CPU Time (ms) 23,270 23,270.2 3.9
Executions 1 N/A N/A
Buffer Gets 2,626,166 2,626,166.0 14.6
Disk Reads 305 305.0 0.3
Parse Calls 1 1.0 0.0
Rows 371,735 371,735.0 N/A
User I/O Wait Time (ms) 564 N/A N/A
Cluster Wait Time (ms) 0 N/A N/A
Application Wait Time (ms) 0 N/A N/A
Concurrency Wait Time (ms) 0 N/A N/A
Invalidations 0 N/A N/A
Version Count 2 N/A N/A
Sharable Mem(KB) 26 N/A N/A
Execution Plan
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | UPDATE STATEMENT | | | | 1110 (100)| |
| 1 | UPDATE | TEST | | | | |
| 2 | TABLE ACCESS FULL | TEST | 116K| 2740K| 1110 (2)| 00:00:14 |
| 3 | TABLE ACCESS BY INDEX ROWID| ACCT | 1 | 26 | 5 (0)| 00:00:01 |
| 4 | INDEX RANGE SCAN | ACCT_DT_ACC_IDX | 1 | | 4 (0)| 00:00:01 |
Plan 2(PHV: 3834848140)
Plan Statistics DB/Inst: TESTDB/TESTDB1 Snaps: 32541-32542
-> % Total DB Time is the Elapsed Time of the SQL statement divided
into the Total Database Time multiplied by 100
Stat Name Statement Per Execution % Snap
Elapsed Time (ms) 0 N/A 0.0
CPU Time (ms) 0 N/A 0.0
Executions 0 N/A N/A
Buffer Gets 0 N/A 0.0
Disk Reads 0 N/A 0.0
Parse Calls 0 N/A 0.0
Rows 0 N/A N/A
User I/O Wait Time (ms) 0 N/A N/A
Cluster Wait Time (ms) 0 N/A N/A
Application Wait Time (ms) 0 N/A N/A
Concurrency Wait Time (ms) 0 N/A N/A
Invalidations 0 N/A N/A
Version Count 2 N/A N/A
Sharable Mem(KB) 26 N/A N/A
Execution Plan
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | UPDATE STATEMENT | | | | 2 (100)| |
| 1 | UPDATE | TEST | | | | |
| 2 | TABLE ACCESS BY INDEX ROWID| TEST | 1 | 28 | 2 (0)| 00:00:01 |
| 3 | INDEX RANGE SCAN | TEST_DT_IND | 1 | | 1 (0)| 00:00:01 |
| 4 | TABLE ACCESS BY INDEX ROWID| ACCT | 1 | 26 | 4 (0)| 00:00:01 |
| 5 | INDEX RANGE SCAN | INDX_ACCT_DT | 1 | | 3 (0)| 00:00:01 |
Full SQL Text
SQL ID SQL Text
51szt7b736bm UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL, 0) +
NVL(ACCT_DR_BAL, 0)) FROM ACCT WHERE ACCT_TRN_DT = (:B1 ) AND PB
RN_ACC_NB = ACCT_ACC_NB(+)) WHERE TEST_BATCH_DT = (:B1 )Your input is highly appreciated.
Thanks for taking your time in answering my question.
RegardsOracle Lover3 wrote:
Dear experts,
awrsqrpt.sql is showing multiple executions plans for a single SQL statement. How is it possible that one SQL statement will have multiple Executions Plans within the same AWR report.If you're using bind variables and you've histograms on your columns which can be created by default in 10g due to the "SIZE AUTO" default "method_opt" parameter of DBMS_STATS.GATHER__STATS it is quite normal that you get different execution plans for the same SQL statement. Depending on the values passed when the statement is hard parsed (this feature is called "bind variable peeking" and enabled by default since 9i) an execution plan is determined and re-used for all further executions of the same "shared" SQL statement.
If now your statement ages out of the shared pool or is invalidated due to some DDL or statistics gathering activity it will be re-parsed and again the values passed in that particular moment will determine the execution plan. If you have skewed data distribution and a histogram in place that reflects that skewness you might get different execution plans depending on the actual values used.
Since this "flip-flop" behaviour can sometimes be counter-productive if you're unlucky and the values used to hard parse the statement leading to a plan that is unsuitable for the majority of values used afterwards, 11g introduced the "adaptive" cursor sharing that attempts to detect such a situation and can automatically re-evaluate the execution plan of the statement.
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/ -
CBO not picking the right execution plan
Database: Oracle 9.2.0.6 EE
OS:Solaris 9
I am trying to tune a query that is generated via Siebel Analytics. I am seeing a behaviour which is puzzling me but hopefully would be 'elementary' for someone like JPL.
The query is based on a total of 7 tables. If I comment out any 2 dimension tables, the query picks up the right index on the fact table. However, the moment I add another table to the query, the plan goes awry.
The query with 5 tables is as below:
select count(distinct decode( T30256.HEADER_FLG , 'N' , T30256.ROW_WID ) ) as c1,
T352305.DAY_DT as c2,
case when T44643.PRODUCT_CLASS_NAME = 'MobileSubscription' then T40081.ATTR15_CHAR_VAL else 'Unspecified' end as c3,
T352305.ROW_WID as c5
from
W_PRODUCT_D T30955,
W_PRDATTRNM_D T44643,
W_DAY_D T352305,
W_ORDERITEM_F T30256,
W_PRDATTR_D T40081
where ( T30955.ROW_WID = T44643.ROW_WID
and T30256.LAST_UPD_DT_WID = T352305.ROW_WID
and T30256.PROD_ATTRIB_WID = T40081.ROW_WID
and T30256.PROD_WID = T30955.ROW_WID
and T30955.PROD_NAME = 'Mobile Subscription'
and (case when T44643.PRODUCT_CLASS_NAME = 'MobileSubscription' then T40081.ATTR15_CHAR_VAL else 'Unspecified' end in ('BT150BB-18M', 'BT250BB-18M', 'BT50BB-18M', 'BT600BB-18M'))
and T352305.DAY_DT between TO_DATE('2008-09-27' , 'YYYY-MM-DD') - 7 and TO_DATE('2008-09-27' , 'YYYY-MM-DD') - 1
group by
T352305.ROW_WID, T352305.DAY_DT,
case when T44643.PRODUCT_CLASS_NAME = 'MobileSubscription' then T40081.ATTR15_CHAR_VAL else 'Unspecified' end
;And the execution plan is as below:
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
| 0 | SELECT STATEMENT | | 269 | 25824 | 18660 (3)|
| 1 | SORT GROUP BY | | 269 | 25824 | 18660 (3)|
| 2 | NESTED LOOPS | | 269 | 25824 | 18658 (3)|
| 3 | NESTED LOOPS | | 6826 | 579K| 4734 (3)|
| 4 | MERGE JOIN CARTESIAN | | 8 | 544 | 6 (17)|
| 5 | NESTED LOOPS | | 1 | 54 | 4 (25)|
| 6 | TABLE ACCESS BY INDEX ROWID| W_PRODUCT_D | 1 | 37 | 3 (34)|
|* 7 | INDEX RANGE SCAN | W_PRODUCT_D_M2 | 1 | | 2 (50)|
| 8 | TABLE ACCESS BY INDEX ROWID| W_PRDATTRNM_D | 1 | 17 | 2 (50)|
|* 9 | INDEX UNIQUE SCAN | W_PRDATTRNM_D_P1 | 1 | | |
| 10 | BUFFER SORT | | 8 | 112 | 4 (0)|
| 11 | TABLE ACCESS BY INDEX ROWID| W_DAY_D | 8 | 112 | 3 (34)|
|* 12 | INDEX RANGE SCAN | W_DAY_D_M39 | 8 | | 2 (50)|
| 13 | TABLE ACCESS BY INDEX ROWID | W_ORDERITEM_F | 849 | 16131 | 592 (3)|
|* 14 | INDEX RANGE SCAN | W_ORDERITEM_F_INDX9 | 852 | | 4 (25)|
|* 15 | INDEX RANGE SCAN | W_PRDATTR_D_M29_T1 | 1 | 9 | 3 (34)|
----------------------------------------------------------------------------------------------Note how the dimension tables W_PRODUCT_D & W_DAY_D are joined using cartesian join before joining to the fact table W_ORDERITEM_F using the composite index 'W_ORDERITEM_F_INDX9'. This index consists of LAST_UPD_DT_WID, PROD_WID and ACTION_TYPE_WID, which are foreign keys to the dimension tables.
Now if I add one more table to the query:
select count(distinct decode( T30256.HEADER_FLG , 'N' , T30256.ROW_WID ) ) as c1,
T352305.DAY_DT as c2,
case when T44643.PRODUCT_CLASS_NAME = 'MobileSubscription' then T40081.ATTR15_CHAR_VAL else 'Unspecified' end as c3,
T30371.X_BT_DLR_GROUP as c4,
T352305.ROW_WID as c5
from W_PRODUCT_D T30955,
W_PRDATTRNM_D T44643,
W_DAY_D T352305,
W_ORDERITEM_F T30256,
W_ORDER_D T30371,
W_PRDATTR_D T40081
where ( T30955.ROW_WID = T44643.ROW_WID
and T30256.LAST_UPD_DT_WID = T352305.ROW_WID
and T30256.PROD_ATTRIB_WID = T40081.ROW_WID
and T30256.PROD_WID = T30955.ROW_WID
and T30256.ORDER_WID = T30371.ROW_WID
and T30955.PROD_NAME = 'Mobile Subscription'
and T30371.STATUS_CD = 'Complete'
and T30371.ORDER_TYPE = 'Sales Order'
and (case when T44643.PRODUCT_CLASS_NAME = 'MobileSubscription' then T40081.ATTR15_CHAR_VAL else 'Unspecified' end in ('BT150BB-18M', 'BT250BB-18M', 'BT50BB-18M', 'BT600BB-18M'))
and T352305.DAY_DT between TO_DATE('2008-09-27' , 'YYYY-MM-DD') - 7 and TO_DATE('2008-09-27' , 'YYYY-MM-DD') - 1
group by T30371.X_BT_DLR_GROUP, T352305.ROW_WID, T352305.DAY_DT,
case when T44643.PRODUCT_CLASS_NAME = 'MobileSubscription' then T40081.ATTR15_CHAR_VAL else 'Unspecified' end;I have added a single table W_ORDER_D to the query, and the execution plan is:
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
| 0 | SELECT STATEMENT | | 44 | 6336 | 78695 (3)|
| 1 | SORT GROUP BY | | 44 | 6336 | 78695 (3)|
| 2 | NESTED LOOPS | | 44 | 6336 | 78694 (3)|
| 3 | NESTED LOOPS | | 269 | 27707 | 78145 (3)|
|* 4 | HASH JOIN | | 6826 | 626K| 64221 (3)|
| 5 | TABLE ACCESS BY INDEX ROWID | W_DAY_D | 8 | 112 | 4 (25)|
|* 6 | INDEX RANGE SCAN | W_DAY_D_M39 | 1 | | 3 (34)|
| 7 | TABLE ACCESS BY INDEX ROWID | W_ORDERITEM_F | 86886 | 2206K| 64197 (3)|
| 8 | NESTED LOOPS | | 87004 | 6797K| 64200 (3)|
| 9 | NESTED LOOPS | | 1 | 54 | 4 (25)|
| 10 | TABLE ACCESS BY INDEX ROWID| W_PRODUCT_D | 1 | 37 | 3 (34)|
|* 11 | INDEX RANGE SCAN | W_PRODUCT_D_M2 | 1 | | 2 (50)|
| 12 | TABLE ACCESS BY INDEX ROWID| W_PRDATTRNM_D | 1 | 17 | 2 (50)|
|* 13 | INDEX UNIQUE SCAN | W_PRDATTRNM_D_P1 | 1 | | |
|* 14 | INDEX RANGE SCAN | W_ORDERITEM_F_N6 | 86886 | | 212 (18)|
|* 15 | INDEX RANGE SCAN | W_PRDATTR_D_M29_T1 | 1 | 9 | 3 (34)|
|* 16 | INDEX RANGE SCAN | W_ORDER_D_N6 | 1 | 41 | 3 (34)|
-----------------------------------------------------------------------------------------------Now CBO doesn't choose the composite index and the cost also has increased to 78695. But if I simply add an /*+ORDERED*/ hint to the above query, so that it should join the dimension tables before joining to fact table, then the cost drops to 20913. This means that CBO is not choosing the plan with the lowest cost. I tried increasing the optimizer_max_permutations to 80000, setting session level optimizer_dynamic_sampling to 8 (just to see if it works), but no success.
Could you please advise how to overcome this problem?
Many thanks.joshic wrote:
Database: Oracle 9.2.0.6 EE
OS:Solaris 9
I am trying to tune a query that is generated via Siebel Analytics. I am seeing a behaviour which is puzzling me but hopefully would be 'elementary' for someone like JPL.
The query is based on a total of 7 tables. If I comment out any 2 dimension tables, the query picks up the right index on the fact table. However, the moment I add another table to the query, the plan goes awry.
I have added a single table W_ORDER_D to the query, and the execution plan is:
Now CBO doesn't choose the composite index and the cost also has increased to 78695. But if I simply add an /*+ORDERED*/ hint to the above query, so that it should join the dimension tables before joining to fact table, then the cost drops to 20913. This means that CBO is not choosing the plan with the lowest cost. I tried increasing the optimizer_max_permutations to 80000, setting session level optimizer_dynamic_sampling to 8 (just to see if it works), but no success.Back to the original question:
* Can you force the index usage of the composite index on W_ORDERITEM_F in the second query using an INDEX hint (instead of the ORDERED hint)? If yes, what does the plan look like, particularly what cost is reported?
* Could you post the plans including the "Predicate Information" section below the plan output?
* What is the definition of the index W_ORDERITEM_F_N6 on W_ORDERITEM_F?
* Are the cardinalities reported in the execution plans close to reality or way off? The best way to verify this would be to run your query with SQL tracing enabled and generate a tkprof output. If you do so please post the tkprof output here as well.
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/ -
How to get the SQL Execution Plan from complex Extractors ?
Hi
I am looking for a way to get the
SQL Execution Plan(s!)
from
Complex Extractors like 0CO_OM_CCA_9 ?
Anybody has got a suggestion ?
How to get this in SM50 ?
ThanXs
MartinIdentifying the query is the hard part. If you can identify it(based on table access or some such parameter, getting the execution plan is easy in ST04 .
Maybe you are looking for
-
Listed below are details on my original problem. One solution I am trying has been to in the connection settings of my browser is to set the proxy to (local, 27.0.0.1) then direct form builder to my browser (firefox) using preferences and selecting r
-
How can I find ringtones for sale in iTunes? I don't see it as a category anywhere.
how can I find ringtones for sale in iTunes? I don't see it as a category anywhere.
-
EVERY TIME the browser boots it kicks off the plug in check. I understand that this is important but it is currently a pain. Once I update Adobe Acrobat Plug in the browser does not recognize that the plug in has been installed and keeps coming up an
-
Reading email in iCloud through Safari
I am running Safari 5.1.7 in Windows 7 Pro and using iCloud for email, calendar, contacts. Suddenly, I cannot read certain emails - they display in the preview screen but the message content is blank if I make them full screen. I can also read them
-
Studying a Big LabVIEW program
In the past, when I had a to modify a big and messy program (with only 2% of documentation), I will study it without a set method, and when I have an adaquate understanding of the program, I would re-code it from scartch, since the original program i