S
Sunil Menon
Dear All,
We are evaluating a few techniques to optimise our Sql statements
being executed at the database.
Scenario:
1. We have a WinForm application that creates Sql statements to be
executed.
2. We have an Oracle database 10g.
3. We plan to use either .net provided provider (NDP) or use ODP.
4. Currently all our Sql statements gets parsed every time at the
database. (Found out by using SqlTrace).
5. We have optimised our Sqls and the only point left to tackle is
parsing.
In our case study we have observed the following:
1. Even if we use bind variables and execute them without preparing
(CommandObject.Prepare) it parses always.
2. If we use bind variables and prepare every time it parses always.
3. If we use bind variables and prepare only once but always use a new
Command object it parses only once. (Not confirmed as we are not able
to take SqlTrace) but performance is fast.
Question:
1. How do we effectively use Bind variables? Do I need to keep track of
every Sql that has been prepared so that I do not prepare it again?
2. Using bind variables using ODP is slower than using bind variables
in NDP. Is there some optimisation string to be put in ConnectionString
missing?
3. Is using Stored procedure better than using bind variables? Does
this mean that we need to create a SP for every Sql statement? or can
we have a generic SP that takes variable parameters. What is the
industry standard followed?
4. I am not able to trace my Sqls if I prepare the Sql statement only
once and use a new Command Object. The application hangs. In the
connection string I have put enlist = false, whereby it stopped giving
gpf (ORA-00603, ORA-00604).
Kindly advice.
Thanks and regards
Sunil
We are evaluating a few techniques to optimise our Sql statements
being executed at the database.
Scenario:
1. We have a WinForm application that creates Sql statements to be
executed.
2. We have an Oracle database 10g.
3. We plan to use either .net provided provider (NDP) or use ODP.
4. Currently all our Sql statements gets parsed every time at the
database. (Found out by using SqlTrace).
5. We have optimised our Sqls and the only point left to tackle is
parsing.
In our case study we have observed the following:
1. Even if we use bind variables and execute them without preparing
(CommandObject.Prepare) it parses always.
2. If we use bind variables and prepare every time it parses always.
3. If we use bind variables and prepare only once but always use a new
Command object it parses only once. (Not confirmed as we are not able
to take SqlTrace) but performance is fast.
Question:
1. How do we effectively use Bind variables? Do I need to keep track of
every Sql that has been prepared so that I do not prepare it again?
2. Using bind variables using ODP is slower than using bind variables
in NDP. Is there some optimisation string to be put in ConnectionString
missing?
3. Is using Stored procedure better than using bind variables? Does
this mean that we need to create a SP for every Sql statement? or can
we have a generic SP that takes variable parameters. What is the
industry standard followed?
4. I am not able to trace my Sqls if I prepare the Sql statement only
once and use a new Command Object. The application hangs. In the
connection string I have put enlist = false, whereby it stopped giving
gpf (ORA-00603, ORA-00604).
Kindly advice.
Thanks and regards
Sunil