Hi everyone!
I've a code reading a very big SQL result froma MySQL database:
my $query = $self->{dbh}->prepare("select * from $database.$self->{hit
+_table} where time between ? and ? order by visit_id, time", {'mysql_
+use_result' => $self->{optimize}});
$query->execute($start_time + 0, $end_time + 0);
while (my $row = $query->fetchrow_hashref())
{
# Do calculation
}
The problem is with the fetchrow_hashref, it take too long and I've a:
DBD::mysql::st fetchrow_hashref failed: Lost connection to MySQL serve
+r during query
the query returns something like 10M of rows from a DB with more than 150M and it takes at least 1 hour.
My question is:
Which is the most performance methode to fetch so big results?
The difference between a fetchrow and a fetchall methode?
TIA
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.