开发者

How to read large number of rows efficiently using Zend_Db?

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 i开发者_开发问答s UNSIGNED INT). What's the best way to approach this?

Environment: PHP 5.2, Zend Framework 1.10, MySQL 5.1


You 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜