The attached mysql queries are inside a while loop inside of a perl script using DBH. Instead of multiple queries, I would like them combined into one mysql query to lighten the server load when the script runs.
(Two queries are acceptable if the bottom/last query can not be combined with the others)
I'm one of the best Perl developers here that's why I'm sure you'll be impressed with my work.
I can show you the right way to execute such queries (actually you need two things: placeholders and transactions).
Thanks.
Roman
$34 USD in 0 day
5.0 (228 reviews)
6.3
6.3
6 freelancers are bidding on average $34 USD for this job
Let's go. Pretty simple query - yes I can do it in a single query, to be clear, a single INSERT/ $dbh->do.
I will send you back a revised .cgi file when you have the milestone in place.
Regards
Hello!
I have re-checked the provided script: it can be easily optimized (all mysql queries can be combined into 1 and it will significantly speed up the insert speed).
Please see my profile for details about my qualification.
I can start right now.
Hope to hearing from you soon.
Hi
I propose changing the $dbh->do statements to the following:
1. one $dbh->prepare statement for all the on order and till $dbh->do statements placed outside the file read loop.
2, one $stmt->execute statement in the file read loop.
I suspect this is not the complete code because you mentioned it executes within a while loop which isn't present in the code you've delivered. Depending on the rest of the code and how this is called, it may be possible to open up the connection to the db outside the while loop and also do the $dbh->prepare statement outside the while loop thus reducing server load further.
e.g.
my $dbh->connect(...);
my $stmt=$dbh->prepare(...);
while (something) {
enter file loop
...
$stmt->execute(..)
}
Hope that makes sense to you.
Please get back to me if you've any queries or what to go ahead with this proposal.
I look forward to hearing from you.
Kind regards
Lesley Binks