学说和大量数据

2022-01-16 00:00:00 php doctrine

我有一个返回约 50k 行的查询,似乎学说将整个结果放入内存中超出内存限制(128M)我发现节省一些内存的唯一解决方案是

i have a query that returns ~50k rows, seems like doctrine put this whole result into memory what exceeds memory limit(128M) the only solution i found that saves some memory is

$result->execute(array(), Doctrine_Core::HYDRATE_NONE);

但仍然超出限制,有没有什么方法可以一次读一行的教义?

but it still exceeds the limit, is there any way to read one row at a time with doctrine ?

推荐答案

Doctrine 文档 - 13. 批处理

更新:对于 1.2,请查看此页面:http://docs.doctrine-project.org/projects/doctrine1/en/latest/en/manual/data-hydrators.html

Update: For 1.2 check out this page: http://docs.doctrine-project.org/projects/doctrine1/en/latest/en/manual/data-hydrators.html

在按需"标题下,您会找到答案.

Under the "On Demand" heading you will find the answer.

相关文章