I have the following set-up:
- Zend Framework 1.10.8
- database adapter: pdo_mysql
- memory limit: 128MB
- table type: myisam
- table size: 4 MB
- number of records: 22.000
- number of columns: aprox. 70
I want to select everything from the table, which should be no problem at all:
$table = new Application_Model_DbTable_Foo();
$everything = $table->fetchAll();
Doing this I run into a “memory exhausted” problem.
I wrote a script using PDO_MYSQL without Zend Framework and the memory usage was fine and it worked all right.
So I must be missing something here. Any hint highly appreciated. 🙂
22k rows alone can a significant amount of data, depending on what your script is doing. If increasing the memory limit isn’t an option, you might want to try this. Grab ‘chunks’ of rows. You can do this with a
LIMIT. Set your page size to something that fits in memory and then process that. Keep increasing yourOFFSETuntil you’ve processed all your data.