Zend Framework, pdo_mysql and Memory Limit Issues - Why?

I have the following setup:

  • Zend Framework 1.10.8
  • database adapter: pdo_mysql
  • memory limit: 128 MB
  • table type: myisam
  • table size: 4 MB
  • number of records: 22.000
  • number of columns: aprox. 70

I want to select everything from a table, which should not be a problem:

$table = new Application_Model_DbTable_Foo();
$everything = $table->fetchAll();

In doing this, I run into the "exhausted memory" problem.

I wrote a script using PDO_MYSQL without the Zend Framework, and the memory usage was great, and everything was fine.

So, I have to miss something. Any hint was much appreciated. :-)

+3
source share
4 answers

22 . , , script. , . "" . LIMIT. , , . OFFSET, .

+2

, , , .: -)

, - , :

 $db = Zend_Db_Table_Abstract::getDefaultAdapter();
   $result = $db->query("SELECT * from footable");
   foreach ($result as $row) {            
           //print $row["field"]; 
  }
  unset($result);

... " LIMIT x, y" -suggestion.

+2

Zend_Db , Zend Framework ( ZF 1.0).

@netcoder, Zend_Db_Table . , , OO save() ..

, fetchAll() . 22000 , 44000 , - 100 000 .

Zend_Db PDO , , , . .

LIMIT, @Chris Henry, , .

, . Zend_Db_Table ; SQL- Zend_Db_Adapter, fetch().

. http://framework.zend.com/manual/en/zend.db.statement.html

+1

Zend_Db , .. (Zend_Db_Table_Row). , -.

0

Source: https://habr.com/ru/post/1773301/


All Articles