Hi everyone,
For my personal use, I am writing a tool written in .NET that shows the execution plan of a query by doing the following :
1) User writes a query into a textbox
2) User clicks on "execute query". The query runs and puts the result into a data grid. The tools uses an OracleDataAdapter and it's Fill() method.
3) The tool shows the execution plan of the query by quering the database on some tables such as V$SQL_PLAN_STATISTICS_ALL and V$SQL
I want to use that tool to improve my queries performances. I want to make it user friendly just like I need.
Actually, the tools works fine, but I have the following problem. When I run a query from the tool, the query execution time is much quicker than when I run the same query from SQL Developer or TOAD. The text of the query is exactly the same. This is a problem for me because most of the queries I need to optimise are run from a batch oriented software that runs every night. A weird thing is that every night the query execution time from the batch tool is the same that when I run the query fom SQL Developer or TOAD. So I woonder why it's not the case from my tool.
I tought that running a query, doesn't matter from wich tool, would take the same execution plan if the text of the query is exactly the same. But it seems that it's not the case.
So my question is : How can I ensure that my query from my textbox will behave exactly like will behave the same query run from the batch tool ? Am I doing something wrong ?
Thank you for your help.
Best regards.
MS