Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Re: Re: Re: Re: Re: mod_perl was hosed by a bind variable

by tantarbobus (Hermit)
on Feb 02, 2004 at 00:44 UTC ( #325760=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Re: Re: Re: mod_perl was hosed by a bind variable
in thread mod_perl was hosed by a bind variable

Your test might be more realisitic; however, your original statement was 'The fastest way to use DBI is with prepare_cached() and bind variables.' which, as proved by the ealier posted counter-example, is false. That was my only point -- that there exists an input that causes your stament to be false, nothing more. Your statement would probably be better worded something like 'The fastet way to use DBI is normally with prepare_cached and bind variables' or 'The fastet way to use DBI is with prepare_cached() and bind_variables except for when it is not' ;-)

Like I said in my origional post, I am just nitpicking, being a pedant, as it were.

  • Comment on Re: Re: Re: Re: Re: Re: mod_perl was hosed by a bind variable

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Re: Re: mod_perl was hosed by a bind variable
by perrin (Chancellor) on Feb 02, 2004 at 03:02 UTC
    I do understand, but when your goal is to help people learn something, the things you leave out are as important as the things you put in. The example you gave is pretty absurd, and I'm skeptical that MySQL would even accept a SQL statement that long. It's not a reasonable use case.

      I'll leave it at this:

      We are looking at it from two different points of view. You are more interested in pedagogy even at the expense of accuracy whereas I am in favour of accuracy even if it serves to confuse slightly. Although I think that a good instructor can do both (think back to your days in math where the proffessor, explaining a proof, does some "handwaving" over the harder parts that require skills yet to be attained)

      FYI, mysql should have no problem accepting the 100,000 char string since the string that DBD::mysql sends to the database is basically just the prepared sql statement with all bind params filled in. So $db->do("This is my ?",{},'x'100_000) becomes something akin to "this is my '@{'x'x100_000}'".

      The truth is that the inflection point where prepare() becomes faster than prepare_cached() is much lower that at x=100_000 (it looks to be somewhere around x=6*1024 of data). I just pulled x=100_000 off the top of my head because hash lookup performance tends to go down as the size of the string increases and at 100,000 I figured that the hash lookup would take more cpu than the work mysql did + object creation overhead, and since I only needed 1 counterexample;therefore, I did not dig any further...

      Oh well...

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2019-10-23 23:45 GMT
Find Nodes?
    Voting Booth?