Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^2: DBI do vs prepare

by astaines (Curate)
on Aug 13, 2006 at 23:57 UTC ( #567131=note: print w/replies, xml ) Need Help??

in reply to Re: DBI do vs prepare
in thread DBI do vs prepare

Not a clue as to why, but I agree with chromatic about your benchmark. In general whether prepare is worth doing depends on what you are talking to. The logic is that some databases have a very heavy overhead for setting up a query, which is what prepare does. So, for repetitive queries you suffer the pain once only. However, this isn't true for all databases, and you may only benefit if you have a lot of repetitive queries to work on.

To progress you need a much purer benchmark to test exactly what you plan to do in the real world. This should be on of the last things you do in the course of development. This avoids the curse of Premature optimization!

!-- Node text goes above. Div tags should contain sig only -->
-- Anthony Staines

Replies are listed 'Best First'.
Re^3: DBI do vs prepare
by BrianC (Acolyte) on Aug 14, 2006 at 00:16 UTC

    I'm still not sure how I'd test without supplying the arguments. Perhaps you could give me an example?

    Actually I am trying to optimize an already functioning program. Code2 and UpdateDBIar are from the current program logic, but I thought I'd try something with the prepare strategy to see if it would be faster.


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2020-07-05 21:22 GMT
Find Nodes?
    Voting Booth?

    No recent polls found