RE: [PEAR] Pear DB Questions

From: Date: Sat, 27 Sep 2003 02:44:11 +0000
Subject: RE: [PEAR] Pear DB Questions
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-8083@lists.php.net to get a copy of this message
Thirdly, there is little overhead in issuing the same query again, even if it is huge as the query plan and result set is cached... For example, I have a quesry that returns approximately 25,000 records each day that does some complex calculations and takes approximately 1.5 hours the first time it is run. It is actually run three times and takes about 2 hundredths of a second the second and third time... Thanks, Rob > -----Original Message----- > From: Lukas Smith [mailto:smith@backendmedia.com] > Sent: Friday, September 26, 2003 12:32 PM > To: 'Stowe, Nola'; pear-general@lists.php.net > Subject: RE: [PEAR] Pear DB Questions > > > > From: Stowe, Nola [mailto:NStowe@TheTTGroup.com] > > Sent: Friday, September 26, 2003 6:25 PM > > > > I have a function that passes mysql result sets to another function, > then > > in > > the second function I use that resource with ... > mysql_result($l_result, > > $j, 'l_key'); > > > > Since I iterate through these result sets alot, I don't really want to > run > > the query everytime I want to run through it and use the DB like > > $result->fetchRow() ... and since these results can be potentially > huge > > (8000 records, avg 20 fields) I dont think I want to fetch the results > > into > > an array, then pass that to the second function. > > > > Any ideas? > > Ok his might come as a shock to you .. but mysql_query buffers the > entire result set on the client. Only mysql_unbuffered_query doesn't. Db > uses mysql_query .. so if you fetch the entire result set you don't > really use any more resources. > > Furthermore php4 has a smart way of handling this situation. Data is > only copied into a separate memory segement once you change the data: > > $foo = 'hello'; > $bar = $foo // no copy is made > $bar = 'world'; // bar gets new memory allocated > > regards, > Lukas > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.pear.general (#8083) next »