Re: managing large result sets

From: Date: Thu, 29 Mar 2001 03:03:05 +0000
Subject: Re: managing large result sets
Groups: php.db 
Request: Send a blank email to php-db+get-7952@lists.php.net to get a copy of this message
Addressed to: "houston" <ahk.nospam@tacits.nospam.com> php-db@lists.php.net ** Reply to note from "houston" <ahk.nospam@tacits.nospam.com> Wed, 28 Mar 2001 12:14:51 -0600 > > I have to deal with displaying result sets that could potentially be quite > large. It would be bad form to drop 10,000 rows into a browser table so I > need a strategy for dealing with this possibility. > > It's obviously not a big deal to limit the output but what is the typical > strategy for handling <next> <previous> behavior? It seems terribly > inefficient to requery for a subset each time. I suppose that I could dump > the entire result set to a text file keyed to the session but that raises > the problem of garbage collection with potentially large files. Anyone have > experience with this problem? It may seen inefficient, but a new query each time is the way to handle it. If you are using MySQL look at the LIMIT clause. SELECT whatever FROM someTable LIMIT start, count Start is the record number of the first entry to return. Count is how many to return. I believe you will find this is not as inefficient as it may seem as it is a common thing to do and the people who wrote MySQL know it. I believe you can count on the database to cache the result set for you, and handle garbage collection if you don't hit it often enough. Rick Widmer Internet Marketing Specialists http://www.developersdesk.com

« previous php.db (#7952) next »