Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

djberg96 (2603)

djberg96
  (email not shown publicly)

Journal of djberg96 (2603)

Thursday July 15, 2004
01:03 PM

When NOT to use placeholders

[ #19867 ]
As a general rule you want to use placeholders whenever possible, as opposed to interpolated statements. So, when might you not want to use placeholders (in Oracle)?

I never really knew until today. Tim Bunce's Programming the Perl DBI (somewhat dated - I haven't checked the latest docs) doesn't say much on the subject other than, "don't use them if your vendor doesn't support them (duh)".

Here's where Guy Harrison's book has enlightened me yet again. The answer? Histograms.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Using placeholders in LIKE clauses is problematic. RDMBSs that prepare queries usually build the execution plan at prepare time. But without knowing what the LIKE clause looks like (e.g., 'foo%' vs. '%foo'), the query planner has to assume worst-case, which means a full table scan. Oracle has some knob you can twist to get better behavior, but it's buried in the docs.
    • Oracle has some knob you can twist to get better behavior, but it's buried in the docs

      There's probably a hint you can use. While I think hints are both nice and powerful, there is simply no way your average developer is going to remember them all. At least, I doubt that I ever will.