The fetchrow methods fetch one row (and place it into an array or a hash). The fetchall methods fetch
all the selected rows at once, and place them into a an array of arrays, or an array of hashes. For large result sets, you definitely don't want the fetchall methods: you're better off dealing with each row of the results as it comes.
Regardless of which of those two methods you call some databases (MySQL among them) still gather all the results on their end into an array first, and then feed them back to you. The consequence, as you saw, is a very lengthy query.
When I ran into this problem, my solution was to find a field in the table I was fetching that had something resembling a flat distribution over it's range of values, and selected the table in chunks based on that key.
Considering that you're selecting based on the time, I suggest that you make multiple selects with smaller differences between $start_time and $stop_time, (selecting by hours instead of by days, for instance) and then merge the results in your program.
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.