Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Execution plan is different and query quicker when ran with a .NET OracleDataAdapter versus SQL Deve

User_HMTR3Aug 27 2018 — edited Aug 29 2018

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

This post has been answered by User_HMTR3 on Aug 28 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 26 2018
Added on Aug 27 2018
41 comments
2,178 views