Why not do something like:
my $q = DELETE FROM master WHERE master_id NOT IN (;
$q .= join(',', @masteridarray);
$q .= ')';
$dbi_dbh-do($q);
Though this will obviously fall into the same size limitations that you were
doing, but it should execute a lot faster, and be a bit
My code generates a large query. I had to increase the size of
max_allowed_packet so that this query would work.
I have this in my /etc/my.cnf file:
set-variable = max_allowed_packet=2097152
-bill
-
Before posting, please
On 21-Jun-01 Chris Petersen wrote:
Why not do something like:
my $q = DELETE FROM master WHERE master_id NOT IN (;
$q .= join(',', @masteridarray);
$q .= ')';
$dbi_dbh-do($q);
Though this will obviously fall into the same size limitations that you were
doing, but it
Thanks, Don. However, this is sort of the opposite of what we need. We
need to delete from master where master_id NOT IN the array. If we do that
in chunks, after the first chunk, we would have wiped out all of the records
outside the array.
It seems like with Chris's suggestion, along with
here, @ids is the array, delete in chunks of 64:
while ( my(@id)= splice(@ids,0,64)) {
$qry=DELETE FROM master WHERE master_id in (.join(',',@id).);
SQLQuery($qry);
}
I thought about this, too.. But Mark said that he needed to delete from the
table where the ID's don't match. If you
On 21-Jun-01 Chris Petersen wrote:
here, @ids is the array, delete in chunks of 64:
while ( my(@id)= splice(@ids,0,64)) {
$qry=DELETE FROM master WHERE master_id in (.join(',',@id).);
SQLQuery($qry);
}
I thought about this, too.. But Mark said that he needed to delete from the