Complied Version of Statement (Preapared=True)
Hello,
I have a small .NET application. I use bind variables all overe my
application. But my parse:execute ratio is 1 for all of my SELECT
statements. There are many softparses in my application. I have also set session_cached_cursors.
DB Version 9.2.0
OS NT
Provider: OraOLEDB 9.2.0.1.0
While using ADODB command object I set the "Prepared" parameter to true. But
even though
there are many parses.
Heres is the simple block of code ..
strCmd = "SELECT DISTINCT TO_CHAR(exp_date,'Month') Months, " _
TO_CHAR(exp_date,'MM') MM FROM expenses ORDER BY MM"
cmd1 = New ADODB.Command()
cmd1.ActiveConnection = cConn
cmd1.CommandText = strCmd
cmd2 = New ADODB.Command()
cmd2.ActiveConnection = cConn
cmd2.CommandText = strCmd
cmd2.Prepared = True
For intLoop = 1 To 4
cmd1.Execute()
Next intLoop
For intLoop = 1 To 4
cmd2.Execute()
Next intLoop
Heres the tkprof trace output
################################################## ##############################
SELECT DISTINCT TO_CHAR(exp_date,'Month') Months, TO_CHAR(exp_date,'MM') MM
FROM
expenses ORDER BY MM
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ----------
----------
Parse 8 0.00 0.00 0 0 0 0
Execute 8 0.04 0.06 0 0 0 0
Fetch 8 0.01 0.01 0 56 0 226
------- ------ -------- ---------- ---------- ---------- ----------
----------
total 24 0.06 0.07 0 56 0 226
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: 62
Rows Row Source Operation
------- ---------------------------------------------------
23 SORT ORDER BY
23 TABLE ACCESS FULL EXPENSES
################################################## ##############################
Logically it should be one parse and 8 execution. Will anybody please
suggest me, how do I minimise the number of parses?
Thanks in advance
Sameer
|