Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: how to speed up querys to mysql

by reneeb (Chaplain)
on Oct 19, 2006 at 10:59 UTC ( #579327=note: print w/ replies, xml ) Need Help??


in reply to how to speed up querys to mysql

You should prepare the statements before you iterate through the loops and use the ?-notation:

my $statement = 'SELECT a1.ID FROM a1, a1_b1, b1 WHERE b1.id = ? AND a +1 = ?'; my $sth = $dbh->prepare($statement) or die $dbh->errstr(); for my $a1(@array1){ for my $b1 (@array2){ $sth->execute($b1,$a1) or die $dbh->errstr(); # ... other stuff ... } }


Comment on Re: how to speed up querys to mysql
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2015-07-08 06:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (94 votes), past polls