sen has asked for the wisdom of the Perl Monks concerning the following question:

Hi All,

Can we use Oracle Optimizer Hints in Statement Handle Methods. e.g.,

$sth = $dbh->prepare("SELECT /*+ index(a index1) */ name, age FROM people a WHERE name LIKE ?");

if we use the hints, whether the hints are used by the Oracle Optimzer when the SQL gets executed?

Thanks

Replies are listed 'Best First'.
Re: Using Optimizer Hints
by chacham (Prior) on Jul 24, 2015 at 13:01 UTC

    Why not? It's part of the statement.

    whether the hints are used by the Oracle Optimzer

    Whether Oracle will honor or ignore a hint is an Oracle question, not a Perl one.

    As a side note, hints "are the path of last resort."

      Thanks for the reply. But its not picked by the Oracle Optimizer when its executed through perl.

        When you run it directly in Oracle, is the hint used? That is, with a host variable.