how to get the explain plan of a insert statement [message #128405] |
Mon, 18 July 2005 06:51 |
d.dineshkumar
Messages: 211 Registered: April 2005 Location: Kolkatta
|
Senior Member |
|
|
hi bosses,
how to get the explain plan of a insert statement. I know how to do it for select but for insert.
suppose this is the statement:
INSERT INTO EMP(EMPNO,ENAME,SAL) VALUES(p_empno,p_enm,12000);
here p_empno and p_enm are variables.
Thanks 4 ur reply.
Dinesh
|
|
|
|
Re: how to get the explain plan of a insert statement [message #128414 is a reply to message #128411] |
Mon, 18 July 2005 07:42 |
d.dineshkumar
Messages: 211 Registered: April 2005 Location: Kolkatta
|
Senior Member |
|
|
Thanks mahesh,
as it is an insert stement ,so it is having consistent gets.Am i correct.if it is a select statement then??
Actulayy mahesh i have been told to find the cost of each query so how to start this procedure.What should i look in this set autotrace output.
Thanks
Dinesh
|
|
|
|
|
Re: how to get the explain plan of a insert statement [message #128422 is a reply to message #128417] |
Mon, 18 July 2005 08:06 |
d.dineshkumar
Messages: 211 Registered: April 2005 Location: Kolkatta
|
Senior Member |
|
|
Mahesh,
actually there is an existing package. and it is showing 100%cpu usage while on testing.
So we have been told to find the cost of all the select,insert,update used in that package.
I know one thing that the cost shown in explain plan is an arbitary value.
but how to get the query's performance cost.
I hope u have understand the problem.
Thanks
Dinesh
|
|
|
|
|
|
|
Re: how to get the explain plan of a insert statement [message #128441 is a reply to message #128433] |
Mon, 18 July 2005 09:50 |
d.dineshkumar
Messages: 211 Registered: April 2005 Location: Kolkatta
|
Senior Member |
|
|
mahesh,
how can i get the execution plan of the insert statement that i have used in my procedure,where i am not giving original values but variables of my procedure.
For ex:-
INSERT INTO TABLEA(A1,A2,A3) VALUES(p_a1,p_a2,p_a3);
Here p_a1/a2/a3 are variables.
Thanks
Dinesh
|
|
|
Re: how to get the explain plan of a insert statement [message #128447 is a reply to message #128441] |
Mon, 18 July 2005 11:15 |
|
Mahesh Rajendran
Messages: 10708 Registered: March 2002 Location: oracleDocoVille
|
Senior Member Account Moderator |
|
|
Obviously you are not reading the docs.
In the explain plan
INSERT STATEMENT GOAL: CHOOSE
is the plan.
A level 12 tracing will include your Bind variables.
--
--
--
scott@9i > alter session set timed_statistics=true;
Session altered.
scott@9i > alter session set max_dump_file_size=unlimited;
Session altered.
scott@9i > alter session set tracefile_identifier='DINESH';
Session altered.
scott@9i > alter session set events '10046 trace name context forever, level 12';
Session altered.
scott@9i > variable dno number;
scott@9i > variable loc varchar2(10);
scott@9i > variable dname varchar2(10);
scott@9i > exec :dno :=9
PL/SQL procedure successfully completed.
scott@9i > exec :loc :='b'
PL/SQL procedure successfully completed.
scott@9i > exec :dname :='b';
PL/SQL procedure successfully completed.
scott@9i > insert into dept (deptno,dname,loc) values (:dno,:dname,:loc);
1 row created.
scott@9i > commit;
Commit complete.
scott@9i > alter session set events '10046 trace name context off'
2 ;
Session altered.
oracle@mutation#tkprof mutation_ora_18504_DINESH.trc Dinesh2.txt explain=scott/tiger
139 insert into dept (deptno,dname,loc)
140 values
141 (:dno,:dname,:loc)
142
143
144 call count cpu elapsed disk query current rows
145 ------- ------ -------- ---------- ---------- ---------- ---------- ----------
146 Parse 1 0.00 0.00 0 0 0 0
147 Execute 1 0.00 0.00 0 1 4 1
148 Fetch 0 0.00 0.00 0 0 0 0
149 ------- ------ -------- ---------- ---------- ---------- ---------- ----------
150 total 2 0.00 0.00 0 1 4 1
151
152 Misses in library cache during parse: 1
153 Optimizer goal: CHOOSE
154 Parsing user id: 32 (SCOTT)
155
156 Rows Execution Plan
157 ------- ---------------------------------------------------
158 0 INSERT STATEMENT GOAL: CHOOSE
159
160
|
|
|
|