Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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

by tantarbobus (Hermit)
on Jan 30, 2004 at 22:49 UTC ( [id://325436]=note: print w/replies, xml ) Need Help??


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

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: mod_perl was hosed by a bind variable
by perrin (Chancellor) on Jan 31, 2004 at 00:08 UTC
    Uh, your SQL query is 100,000 characters long? If I change your benchmark to use "select foo from bar where baz = ?", prepare_cached is 333% faster. I'm thinking my test is a bit more realistic.
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re^5: mod_perl was hosed by a bind variable
by dws (Chancellor) on Jan 31, 2004 at 02:33 UTC
    Not to be a pedant, but prepare() can be faster than prepare_cached() 56% faster, in fact ;)

    To be a pedant, your benchmark is highly misleading. prepare() might be faster, but the speed gain is barely visible when you actually execute the query. When you're using a database that supports prepared queries (e.g., Oracle), the cached form is a win. In the example you show, no communication with the server happens, since current versions of MySQL don't support prepared queries. What you're seeing is bookkeeping overhead.

      I don't think my benchmark is misleading. I set out to show that in at least one case prepare() CAN be faster than prepare_cached(), to provide a counter example, as it were. The benchmark that I posted shows that in some cases prepare() CAN be faster than prepare_cached() nothing more, nothing less.

      Now, prepare_cached()is normally faster and I am not saying that it is not, but there a point where the overhead of calculating the hash and doing the hash lookup takes more CPU time than it does for DBD::mysql to walk the string looking for placeholders.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-04-16 14:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found