Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
The stupid question is the question not asked
 
PerlMonks  

Re: Where the advice to use DBI bind parameters can go wrong (long)

by perrin (Chancellor)
on Jun 14, 2002 at 20:14 UTC ( #174717=note: print w/ replies, xml ) Need Help??


in reply to Where the advice to use DBI bind parameters can go wrong (long)

There's probably a way to give Oracle an optimizer hint that would take care of this. I've seen DBAs use optimizer hints to make Oracle use certain indexes before.


Comment on Re: Where the advice to use DBI bind parameters can go wrong (long)
Re: Re: Where the advice to use DBI bind parameters can go wrong (long)
by dws (Chancellor) on Jun 14, 2002 at 20:19 UTC
    There's probably a way to give Oracle an optimizer hint that would take care of this. I've seen DBAs use optimizer hints to make Oracle use certain indexes before.

    Not in this case. Hints influence how a query gets executed, but not in ways (as far as I know) that would result in the answer being wrong. Honoring a "trust me, you can use an index" hint would result in a bogus result set if the value bound for a LIKE clause had a leading wildcard.

    Hints are great when a query plan is joining tables in a reasonable, but suboptimal, sequence. Any way you join should give you the same result set.

      We ran into this problem with some of our code. When our DBA talked with Oracle Tech Support, they said to use an index hint. The Oracle tech said that an index would then be used, unless the parameter started with wildcard. At that time it would recompile the query to not use the index. Oracle would then keep both versions of the query cached and would use the appropriate one. The hints are just that, hints. If it doesn't work then Oracle ignores them.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://174717]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2014-04-19 00:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (474 votes), past polls