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 ]

jdavidb (1361)

jdavidb
  (email not shown publicly)
http://voiceofjohn.blogspot.com/

J. David Blackstone has a Bachelor of Science in Computer Science and Engineering and nine years of experience at a wireless telecommunications company, where he learned Perl and never looked back. J. David has an advantage in that he works really hard, he has a passion for writing good software, and he knows many of the world's best Perl programmers.

Journal of jdavidb (1361)

Tuesday August 08, 2006
01:33 PM

DBI performance: true or false

[ #30567 ]

I'm being told by a Java programmer that use of the bind_param method on a statement handler is more efficient than calling execute with the parameters. He thinks that if I don't use bind_param that Perl does the binding instead of allowing Oracle to do it and so Oracle has to parse two different statements that don't match if I execute it twice. True? False?

Update: And the answer is: false. He checked in the database. He sounded mildly surprised.

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.
  • execute() calls bind_param for each argument. Which means it'll bind parameters every time you call execute() if you do it that way. If you instead are able to call bind_param() just once to bind the SQL placeholders to variables, and execute() with no arguments (then change the value of the variables, call execute() again, etc.), you save those extra implicit calls to bind_param(), which makes it slightly more efficient to do it this way...slightly...I think (...someone please prove me wrong). But his rea
    • I'm wrong:

      The "bind_param" method takes a copy of $bind_value and associates...

      You're binding a copy of the value, not the variable itself (like with bind_columns). I'm way off.

      • Yeah, plus internally the DBD implementations do all this work in C, they don't tend to have much access to the perl level.

        It's also worth noting that this is entirely DBD driver dependent. I believe old versions of the MySQL DBD used to bind the variables into the string sent to the database because MySQL had no bind param support (it does now, IIRC).