MySQL Forums
Forum List  »  Perl

Re: perl script performs poorly - please advise
Posted by: Patrick Hollins
Date: April 07, 2009 06:10PM

In general, fetchrow_array is faster than fetchrow_hashref. Try it.

In remove dups, you might be reading unnecessary rows. Consider omitting the ORDER BY and adding a HAVING occur > 1.

While you could also: last if $bad_rec->{'occur'} = 1, you are doing a sort to make that logic work. Either way you reading less rows.

In the second section, you should only select email, not *. Then create an array:

while ( ($drop) = $never_sql->fetchrow_array() ) {
push @to_drop, $dbh->quote($drop);
$drop_sql = "update mailers set sent = 'y' where email = " . join(' OR email = ',@to_drop);
my $c_sql = $dbh->do($drop_sql);

Your read/write read/write... becomes read read read... write

That should be a good tune up. Good Luck!

Options: ReplyQuote

Written By
Re: perl script performs poorly - please advise
April 07, 2009 06:10PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.