Re: [PHP] Database vs. Array
[email protected] (Ryan Sun)
| Newsgroups | php.general |
|---|---|
| Message-ID | <[email protected]> |
Maybe you want to optimize your script first, and I don't think read entire data set into array would save you much time. Don't create new variables when its unnecessary, cache data when its necessary, try memcached, and I think heavy php cli scripts are always likely to resume a lot of resource, I think GC of php is not so reliable... or maybe I don't know how to use it. On 3/16/2010 7:13 PM, Richard S. Crawford wrote: > 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. > >