且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

CodeIgniter-如何在没有内存泄漏的情况下选择大表中的所有行

更新时间:2022-11-04 14:01:33

除了类似的操作与性能问题高度相关的事实外,您还可以使用 unbuffered_row .

Beside the fact that operations like that are highly connected to performance issues, you can use unbuffered_row.

基本上,如果您的工作具有如此大的数据,则应使用已提供 unbuffered_row 并将其集成到已构建的在查询生成器中.

Basically, if you have a job with that large data - you should use unbuffered_row provided and integrated in the built in query builder.

在结果行部分的此处中有据可查.

its very well documented here in the result rows section.

例如:

$query = $this->db->select('*')->from('your_table')->get();

while($row = $query->unbuffered_row())
{
    //do your job
}

这将避免您的内存问题.

This will avoid your memory problem.