How can I efficiently read a large number of lines using Zend_Db?

Is there a simple :) and efficient way or reading a very large number of lines sequentially using Zend_Db?

Basically I need to process the entire table, sequentially. The table is large, the sequence of primary keys is not guaranteed (i.e. not autoincrement, but UNNIGNED INT). What's the best way to approach this?

Environment: PHP 5.2, Zend Framework 1.10, MySQL 5.1

+2


a source to share


1 answer


You can always load a subset of the records using the constraint function.

$table = new Default_Models_Something();
$table = $table->fetchAll($table ->select(true)->limit(10, $offset));

      



So, with this logic, you will find out how many records are in the table, and then retrieve 10 records at a time, increasing your count each time.

+1


a source







All Articles