mysql returns all the rows by default, if large could eat up all the memory. Do a perldoc DBD::mysql and look for "use_result", I forget the syntax. This will return the rows...here I will paste the docs,
Note, that most attributes are valid only after a successfull execute. An undef value will returned in that case. The most important exception is the mysql_use_result attribute: This forces the driver to use mysql_use_result rather than mysql_store_result. The former is faster and less memory consuming, but tends to block other processes. (That's why mysql_store_result is the default.) To set the mysql_use_result attribute, use either of the following: my $sth = $dbh->prepare("QUERY", { "mysql_use_result" => 1}); or my $sth = $dbh->prepare("QUERY"); $sth->{"mysql_use_result"} = 1; On 26-Jul-2002 Reid Sutherland wrote: > Hi, > > I'm using DBI with mysql. > > Here's what I'm doing. > > <code> > use strict; > use DBI; > my $sqlhost='localhost'; > my $sqluser='username'; > my $sqlpass='password'; > my $sqldb='database'; > > my $statement=qq{select > >remote_host,remote_user,request_uri,time_stamp,status,bytes_sent,referer,agent,request_method,request_protocol > > from \`table\` where virtual_host='domain.com'}; > > my > $dbh=DBI->connect("DBI:mysql:database=$sqldb;host=$sqlhost",$sqluser,$sqlpass); > > print "Preparing\n"; > my $records=$dbh->prepare($statement); > print "Executing\n"; > $records->execute; > sleep(10); > </code> > > The table is about 500 megs, and that's how much memory is used after > the select statement is executed using execute(); > > This seems _very_ wrong. > > Any ideas? > > -reid > > perl-5.6.1 (i386) > dbi-1.2.1 > dbd-mysql-1.2216 > ---------------------------------- E-Mail: [EMAIL PROTECTED] Date: 26-Jul-2002 Time: 16:12:28 ----------------------------------