Hi. Can anyone give me any pointers as to why this is so slow to run the updates?
my ($old_id,$image_name,$field);
my $i = 0;
my $count = 0;
while (<GRAB>) {
chomp;
my $_update;
my @cut = split /\|/, $_;
# skip the beginning line....
if (/HotelID/) { next; }
#print "$count: HotelID: " . $cut[0] . "\n";
unless ($count % 10) { print "> $count\n"; }
my $hotel_id = $cut[0];
my $desc = $cut[1];
undef @cut;
$count++;
if ($DB->table('Links')->count( { HotelID => $hotel_id } )) {
$DB->table('Links')->update( { Description => $desc } , { HotelID => $hotel_id } ) or die $GT::SQL::error;
}
}
close(GRAB);
It is taking about 1 minute to complete 160 entries, which is far too slow. There are almost 50,000 to run... which would take about 5 1/2 hours!
I just can't see why its going so slow.
Anyone got any ideas?
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Code:
open(GRAB, "Hotel_Description_Cut_1.txt") or die "Error reading Hotel_Description_Cut_1.txt. Reason: $!"; my ($old_id,$image_name,$field);
my $i = 0;
my $count = 0;
while (<GRAB>) {
chomp;
my $_update;
my @cut = split /\|/, $_;
# skip the beginning line....
if (/HotelID/) { next; }
#print "$count: HotelID: " . $cut[0] . "\n";
unless ($count % 10) { print "> $count\n"; }
my $hotel_id = $cut[0];
my $desc = $cut[1];
undef @cut;
$count++;
if ($DB->table('Links')->count( { HotelID => $hotel_id } )) {
$DB->table('Links')->update( { Description => $desc } , { HotelID => $hotel_id } ) or die $GT::SQL::error;
}
}
close(GRAB);
It is taking about 1 minute to complete 160 entries, which is far too slow. There are almost 50,000 to run... which would take about 5 1/2 hours!
I just can't see why its going so slow.
Anyone got any ideas?

Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!