Hello Greg,

  maybe it can be of some help:

  - Try ( if memory is not a problem ) to read the entire file in memory,              
          
     inside an array, and use foreach() in the array. It is quicker than      
     reading line by line from the HD;

 - And you may try to mount your UPDATE statement to update a bunch
    of emails at once, using 'WHERE email IN( email1, email2, ..., emailN )'.
    You can try with 1000 or 10000 at a time, mounting the statement and 
    executing after you have a list of emails, instead of using bind values.

This may or may not be of some help.


On Thursday 06 June 2002 12:51, Greg D. wrote:
> Hello,
>
>       I was wondering if there was a better way to speed up
> my update statement in my perl script.  It goes through all the
> entries in the database , which is around 800, 000, and then updates the
> email field.  The problem is that it takes to long.
> thanks in advance for any help
>
> here the code:
>
>
> open(A, "$ktjpath/$ktjlist") || &death("Can't open $ktjlist: um121");
>
> my $sql_statement = "UPDATE ktj SET ktjnews = 'N' WHERE email = ?";
> my $sth = $dbh->prepare($sql_statement) || die "Error1 preparing update
> statement on track:\n" . $dbh->errstr;
>
> while (<A>){
>
>         print "$_\n";
>         $sth->execute($_) || die "Error2 executing update statement on
> track:\n" . $sth->errstr;
> }
> close A;







-- 
Joćo Paulo Vasconcellos
Gerente de Tecnologia - NetCard
Tel. 21 3852-9008 Ramal 31
[EMAIL PROTECTED]

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to