Re: DB memory grow with many select

From: Date: Fri, 15 Oct 2004 11:25:22 +0000
Subject: Re: DB memory grow with many select
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-14920@lists.php.net to get a copy of this message
Vincent SABOURDY wrote:
for ($i=0;$i<100000;$i) { $sql = "select id from table where id=x"; $db->query($sql); } if i run this code memory usage grow up, during for loop but if i use mysql_query($sql) instead of $db->query($sql), memory usage stay the same during all for loop Have you an idea to solve my problem ?
I'm pretty sure you should be freeing your results (see free()). in this case, however, I'd recommend using $db->getOne() or others of that kind. are you sure you really need a loop and can't get the database to do the work? your example sure looks like it would. it's all in the docs: http://pear.php.net/manual/en/package.database.db.php cheers mb -- /* no comment */ Please use my public PGP key: http://www.mbant.de/mbant-gpg-key

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