MySQL Forums
Forum List  »  Perl

Re: perl script performs poorly - please advise
Posted by: Rick James
Date: April 11, 2009 09:37PM

A rule of thumb: If you are looping through the output of one SELECT in order to do a bunch of other statements (DELETEs, UPDATEs, in your case), you are not using the power of SQL. It should be possible to your two snippets in two statements.

Does never2 have just one column? Consider this:
CREATE TABLE new_never 
    SELECT DISTINCT email FROM never2;
RENAME TABLE never2 TO old_never,
             new_never TO never2;
DROP TABLE old_never; 
    ADD PRIMARY KEY(email);
Ok, that's 3 statements. But muuuuuch faster.

The other one would involve a multi-table update:
(and should take only one command)

BTW, there needs to be an index on email for the never2 table.

Options: ReplyQuote

Written By
Re: perl script performs poorly - please advise
April 11, 2009 09:37PM

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.