Re: out of memory



Assuming you're using mysql, take a look at the mysql_use_result attribute.

Tim.

On Thu, Dec 28, 2006 at 01:48:28PM -0800, louis fridkis wrote:
I am running out of memory when I try to select about 100K rows. Here is
some code:

my $cel_sth = $dbh_from->prepare($sqlstring);
$cel_sth->execute();
my @rowvalues;
my $rv;
my $elementresult_id;
my $element_id;
my $quantification_id;
my $signal;

$rv = $cel_sth->bind_columns(\($elementresult_id, $element_id,
$quantification_id, $signal));

while($cel_sth->fetch()){
@rowvalues = ($elementresult_id, $element_id, $quantification_id,
$signal);
my $printstring= "insert into $table_name values(";
foreach my $column (@rowvalues){
if (defined $column){
if($column =~ /\D/){
$column = "'".$column."'"
unless ($column =~ /\d*\.\d+/);
}
$printstring.= "$column,";
} else {
$printstring.= "NULL,";
}
}
$printstring =~ s/,$/);/;
print "$printstring\n";
}

I guess the problem is it tries to hold all the rows in memory. Is there a
way to just get 1 or a few rows at a time?
--
Lou Fridkis
Human Genetics
57920
.



Relevant Pages

  • out of memory
    ... I am running out of memory when I try to select about 100K rows. ... my @rowvalues; ... foreach my $column { ... Lou Fridkis ...
    (perl.dbi.users)
  • Re: MySQL crashes on amd64
    ... >>1) Exchanging memory on the machine did not work. ... This is obviously not a hardware issue. ... The errors are reproducable for MySQL 4.1.15 and MySQL 5.0.15 so ... It is possible that mysqld could use up to ...
    (freebsd-current)
  • Re: MySQL crashes on amd64
    ... >>1) Exchanging memory on the machine did not work. ... This is obviously not a hardware issue. ... The errors are reproducable for MySQL 4.1.15 and MySQL 5.0.15 so ... It is possible that mysqld could use up to ...
    (freebsd-questions)
  • Re: MySQL/PHP: Check data length before INSERT?
    ... >> MySQL should cut it for you, if it is too long to fit, but of course ... >> never know if there is a bug in MySQL. ... buffer overrun is where you allocate a block of memory of fixed size, ... in PHP, this is not anything that you as a user of PHP need to be concerned ...
    (comp.lang.php)
  • Re: Page Cache writeback too slow, SSD/noop scheduler/ext2
    ... When memory gets low this will result in very irregular performance drops. ... These are single purpose machines running MySQL. ... The wk_update function does not write enough dirty pages, ...
    (Linux-Kernel)