Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: fetch row or fetchall

by steves (Curate)
on Nov 09, 2004 at 20:46 UTC ( #406493=note: print w/ replies, xml ) Need Help??


in reply to fetch row or fetchall

You can still count the rows and only use the first 100: your loop could keep the first 100 but continue counting until fetching is complete. It's about the same as fetching all of them using a DBI fetchall call, but fetching would probably (but not necessarily depending on the underlying database driver) use more memory in your application.


Comment on Re: fetch row or fetchall
Re^2: fetch row or fetchall
by pg (Canon) on Nov 09, 2004 at 21:08 UTC
    "your loop could keep the first 100 but continue counting until fetching is complete"

    I would rather do a seperate query for count(), for performance. Although you are skipping, not using the fetch result, they still get transferred across, and waste band width.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://406493]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2014-09-17 00:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (55 votes), past polls