Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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


Comment on Re^2: DBI do vs prepare
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.

    Brian

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2014-10-01 18:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (32 votes), past polls