Database vs. Array

From: Date: Tue, 16 Mar 2010 23:13:50 +0000
Subject: Database vs. Array
Groups: php.general 
Request: Send a blank email to php-general+get-302916@lists.php.net to get a copy of this message
I have a script that connects to an external database to process about 4,000 records. Each record needs to be operated on pretty heavily, and the script overall takes about half an hour to execute. We've hit a wall where the script's memory usage exceeds the amount allocated to PHP. I've increased the allotted memory to 32MB, but that's not ideal for our purposes. So my thought is, would it be more efficient, memory-wise, to read the database entries into an array and process the array records, rather than maintain the database connection for the entire run of the script. This is not an issue I've come across before, so any thoughts would be much appreciated. Thanks in advance. -- Richard S. Crawford (richard@underpope.com) http://www.underpope.com Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com)

« previous php.general (#302916) next »