Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Analyze the tkprof output

Re: Analyze the tkprof output

From: Andrey Bronfin <bronfin_at_VisualTop.com>
Date: Tue, 21 Mar 2000 11:41:11 +0200
Message-Id: <10497.105593@fatcity.com>


This is a multi-part message in MIME format.

------=_NextPart_000_009A_01BF932A.5AEB41E0 Content-Type: text/plain;

        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi , Thomas & all !
U're right , but i'm talking about extensive parsing for exactly the = same statement .=20
For example this :
SELECT emp_data=20
from
 emp where emp_id=3D:1

call count cpu elapsed disk query current =

   rows
------- ------ -------- ---------- ---------- ---------- ---------- =


Parse         8      0.01       0.01          0          0          0    =
       0
Execute      4      0.00       0.00          0          0          0     =
      0
Fetch          4      0.00       0.00          0          4         16   =
        4

------- ------ -------- ---------- ---------- ---------- ---------- =
total          16      0.01       0.01          0          4         16  =
         4

U see , there are 2 parses for each fetch and one execute for each fetch = .
As far as i understand there should be 1 parse and one execute for all = the 4 fetches . Isn't it correct ?=20

TIA=20

  You're SQL statements are significantly different.   comparing ename like 'SMITH%' is not the same as empid =3D :1   You will need to compare two similar statements such as empid =3D 1234 = and empid =3D :1

    -----Original Message-----
    From: root_at_fatcity.com [mailto:root_at_fatcity.com]On Behalf Of Andrey = Bronfin

    Sent: Tuesday, May 09, 2000 4:18 AM
    To: Multiple recipients of list ORACLE-L     Subject: Analyze the tkprof output=20

      HI , ALL !
      I'm having a pretty strange tkprof output of a SQL trace .
      There is a Java program that runs SQL queries  , and it looks like =
each statement is parsed 3 times for each execution when we're not using = bind variables ,=20

      and each statement is parsed 2 times when we're using bind = variables .

      There is also an execution for every fetch of a query .
      We use Oracle 8.1.5 on Windows2000 .
      Both the Oracle8i and Windows are new for me . I previously used =
Oracle8 on HP-UX and i never seen this kind of tkprof results .
      Please help !
      TIA=20

      Here is what i have in my *.prf file :

      Select ename,emp_id
      from
       emp where ename like 'SMITH%' order by ename

      call     count       cpu    elapsed       disk      query    =
current        rows

------- ------ -------- ---------- ---------- ---------- =
---------- ---------------------------------------- Parse 15 0.03 0.03 0 0 = 0 0 Execute 5 0.00 0.00 0 0 = 0 0 Fetch 5 0.00 0.00 0 5 = 0 10 ------- ------ --------------------------------- -------- = ---------- ---------- ---------- ---------- ---------- total 25 0.03 0.03 0 5 = 0 10 Misses in library cache during parse: 0 When we use bind variables in the Java program i see the following =
:
      SELECT  emp_data=20
      from
       emp where emp_id=3D:1

      call     count       cpu    elapsed       disk      query    =
current        rows

------- ------ -------- ---------- ---------- ---------- =
---------- ----------------------------------------- Parse 8 0.01 0.01 0 0 = 0 0 Execute 4 0.00 0.00 0 0 = 0 0 Fetch 4 0.00 0.00 0 4 = 16 4
------- ------ -------- ---------- ---------- ---------- =
---------- ----------------------------------------------- total 16 0.01 0.01 0 4 = 16 4 Thanks a lot in advance !!

------=_NextPart_000_009A_01BF932A.5AEB41E0 Content-Type: text/html;

        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2920.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi , Thomas &amp; all !</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>U're right , but i'm talking about =
extensive=20
parsing for exactly the same statement . </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>For example this :</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>SELECT&nbsp; emp_data =
<BR>from<BR>&nbsp;emp where=20

emp_id=3D:1</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><BR>call&nbsp;&nbsp;&nbsp;&nbsp;=20 count&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cpu&nbsp;&nbsp;&nbsp;=20 elapsed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = disk&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
query&nbsp;&nbsp;&nbsp; =
current&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
rows<BR>------- ------&nbsp; -------- ---------- ---------- ----------=20
----------&nbsp;=20
-----------------------------------------<BR>Parse&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20
8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.01&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =

0.01&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20

0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
0<BR>Execute&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20 0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
0<BR>Fetch&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;=20 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =

0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20 16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =

4<BR>-------=20
------&nbsp; -------- ---------- ---------- ---------- ----------&nbsp;=20
-----------------------------------------------<BR>total&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20 16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
0.01&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20 0.01&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20 16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 4</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>U see , there are 2 parses for each fetch and one execute for each = fetch=20
.</DIV>
<DIV>As far as i understand there should be 1 parse and one execute for = all the=20
4 fetches . Isn't it correct ? </DIV>
<DIV>&nbsp;</DIV>
<DIV>TIA </DIV></FONT></DIV>
<DIV>&nbsp;</DIV>
<BLOCKQUOTE=20

style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: = 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">   <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>   <DIV=20
  style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: = black"><B>From:</B>=20
  <A href=3D"mailto:tharleman_at_iquest.net" = title=3Dtharleman_at_iquest.net>Thomas L.=20   Harleman</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A = href=3D"mailto:ORACLE-L_at_fatcity.com"=20
  title=3DORACLE-L_at_fatcity.com>Multiple recipients of list ORACLE-L</A> = </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Thursday, May 11, 2000 = 8:26=20
AM</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> RE: Analyze the tkprof = output=20
  </DIV>
  <DIV><BR></DIV>
  <DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
  class=3D290122006-10052000>You're SQL statements are significantly=20   different.</SPAN></FONT></DIV>
  <DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20   class=3D290122006-10052000>comparing ename like 'SMITH%' is not the = same as=20
  empid =3D :1</SPAN></FONT></DIV>
  <DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN = class=3D290122006-10052000>You=20
  will need to compare two similar statements such as empid =3D 1234 and = empid =3D=20
  :1</SPAN></FONT></DIV>
  <BLOCKQUOTE style=3D"MARGIN-RIGHT: 0px">     <DIV align=3Dleft class=3DOutlookMessageHeader dir=3Dltr><FONT = face=3DTahoma=20
    size=3D2>-----Original Message-----<BR><B>From:</B> <A=20
    href=3D"mailto:root_at_fatcity.com">root_at_fatcity.com</A> [<A=20
    href=3D"mailto:root_at_fatcity.com">mailto:root_at_fatcity.com</A>]<B>On =
Behalf Of=20

    </B>Andrey Bronfin<BR><B>Sent:</B> Tuesday, May 09, 2000 4:18=20     AM<BR><B>To:</B> Multiple recipients of list = ORACLE-L<BR><B>Subject:</B>=20

    Analyze the tkprof output <BR><BR></DIV></FONT>     <BLOCKQUOTE=20
    style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; = MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">

      <DIV><BR></DIV>
      <DIV><FONT face=3DArial size=3D2>HI , ALL !</FONT></DIV>
      <DIV><FONT face=3DArial size=3D2>I'm having a pretty strange =
tkprof output of=20
      a SQL trace .</FONT></DIV>
      <DIV><FONT face=3DArial size=3D2>There is a Java program that runs =
SQL=20
      queries&nbsp; , and it looks like each statement is parsed 3 times =
for=20
      each execution when we're not using bind variables , </FONT></DIV>
      <DIV><FONT face=3DArial size=3D2>and each statement is =
parsed&nbsp;2=20
      times&nbsp; when we're&nbsp; using bind variables&nbsp; =
.</FONT></DIV>
      <DIV><FONT face=3DArial size=3D2>There is also an execution for =
every fetch of=20
      a query .</FONT></DIV>
      <DIV><FONT face=3DArial size=3D2>We use Oracle 8.1.5 on =
Windows2000=20
      .</FONT></DIV>
      <DIV><FONT face=3DArial size=3D2>Both the Oracle8i and Windows are =
new for me=20
      . I previously used Oracle8 on HP-UX and i never seen this kind of =
tkprof=20
      results .</FONT></DIV>
      <DIV><FONT face=3DArial size=3D2>Please help !</FONT></DIV>
      <DIV><FONT face=3DArial size=3D2>TIA </FONT></DIV>
      <DIV>&nbsp;</DIV>
      <DIV><FONT face=3DArial size=3D2>Here is what i have in my *.prf =
file=20
      :</FONT></DIV>
      <DIV>&nbsp;</DIV>
      <DIV><FONT face=3DArial size=3D2>Select =
ename,emp_id<BR>from<BR>&nbsp;emp=20
      where&nbsp;ename like 'SMITH%' order by ename</FONT></DIV>
      <DIV><FONT face=3DArial size=3D2><BR>call&nbsp;&nbsp;&nbsp;&nbsp;=20
      count&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cpu&nbsp;&nbsp;&nbsp;=20
      elapsed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      disk&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; query&nbsp;&nbsp;&nbsp;=20
      current&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rows<BR>-------=20
      ------&nbsp; -------- ---------- ---------- ---------- =
----------&nbsp;=20
      =
----------------------------------------<BR>Parse&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;=20
      15&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
0.03&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0.03&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0<BR>Execute&nbsp;&nbsp;&nbsp;&nbsp; =
5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0<BR>Fetch&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
10<BR>-------=20
      ------&nbsp;--------------------------------- -------- ----------=20
      ---------- ---------- ----------&nbsp;=20
      ----------<BR>total&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      25&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
0.03&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0.03&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
10</FONT></DIV>
      <DIV>&nbsp;</DIV>
      <DIV><FONT face=3DArial size=3D2>Misses in library cache during =
parse:=20
      0</FONT></DIV>
      <DIV>&nbsp;</DIV>
      <DIV>&nbsp;</DIV>
      <DIV><FONT face=3DArial size=3D2>When&nbsp;we use bind variables =
in the Java=20
      program i see the following :</FONT></DIV>
      <DIV>&nbsp;</DIV>
      <DIV><FONT face=3DArial size=3D2>SELECT&nbsp; emp_data =
<BR>from<BR>&nbsp;emp=20
      where emp_id=3D:1</FONT></DIV>
      <DIV><FONT face=3DArial size=3D2><BR>call&nbsp;&nbsp;&nbsp;&nbsp;=20
      count&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cpu&nbsp;&nbsp;&nbsp;=20
      elapsed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      disk&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; query&nbsp;&nbsp;&nbsp;=20
      current&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rows<BR>-------=20
      ------&nbsp; -------- ---------- ---------- ---------- =
----------&nbsp;=20
      =
-----------------------------------------<BR>Parse&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20
      8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
0.01&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0.01&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0<BR>Execute&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0<BR>Fetch&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;=20
      4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      4<BR>------- ------&nbsp; -------- ---------- ---------- =
----------=20
      ----------&nbsp;=20
      =
-----------------------------------------------<BR>total&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
0.01&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0.01&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
Received on Tue Mar 21 2000 - 03:41:11 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US