views:

39

answers:

1

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

Basically I need to process entire table, row by row. Table is large, primary key sequence is not guaranteed(i.e. not an autoincrement, but is UNSIGNED INT). What's the best way to approach this?

Environment: PHP 5.2, Zend Framework 1.10, MySQL 5.1

A: 

tYou could always load a subset of records using the limit function.

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

So with that logic you find out how many records are in the table and then extract 10 records at a time incrementing your offset everytime.

Iznogood