Re: Doing a query with string vs bind variables.



Luch (DarthLuch@xxxxxxxxx) wrote:
: We have a PowerBuilder application where we started noticing the
: performance of a query is worse if you do it with bind variables then
: if you do the same query as a string.

Bind variables minimize the number of times a query must be parsed. That
is likely to speed up your application if the same queries are used
multiple times.

Hard coded values allow the optimizer to select the best possible path to
select the data. That is likely to speed up your application if a query
is only run once, or if the time to parse the query is small compared to
the time it takes to run the query, especially if the values are unusual
compared to most of the data.

Apparently more recent versions of Oracle (version?) will examine the
values of bind variables before running a query as a sanity check that the
existing parsed query will still be sensible for those values. I know not
the exact details.

$0.10

.



Relevant Pages

  • Re: How to pass bind variable value into a view
    ... :>: query. ... :> You can also create a package and use it to store variables (which must be ... variable to the inner query". ... if bind variables were in use. ...
    (comp.databases.oracle.server)
  • Re: How to pass bind variable value into a view
    ... :>: query. ... :> with this you must create a context and a package to update the context ... variable to the inner query". ... if bind variables were in use. ...
    (comp.databases.oracle.server)
  • Re: Clarification on DBI module
    ... You get the same results for the second execute because the record buffer in the statment handle is not cleaned out because no execute took place. ... The sql query can have bind variables or they may not have. ... Ahhh...imagining that irresistible "new car" smell? ...
    (perl.dbi.users)
  • Re: Bind variables
    ... I have a session with a query very long ... SELECT SUM (glaa) "AA" ... AND globj < 800000 ... I can see the query there are bind variables ...
    (comp.databases.oracle.server)
  • Re: Clarification on DBI module
    ... In my environment I am using single module to prepare and execute the sql ... queries. ... The sql query can have bind variables or they may not have. ...
    (perl.dbi.users)