phpcr-odm icon indicating copy to clipboard operation
phpcr-odm copied to clipboard

implement Query::iterate

Open dbu opened this issue 11 years ago • 7 comments

Implement the Query->iterate method which will return an IteratableResultSet as per the ORM.

dbu avatar Feb 15 '14 13:02 dbu

:+1: I am surprised it isn't there already. I keep hitting memory limits whenever I have to rebuild my elasticsearch index from the database. Surprisingly detaching while iterating during a foreach doesn't free up memory.

juzerali avatar Jul 10 '14 09:07 juzerali

you are welcome to do a PR to implement the feature ;-)

dbu avatar Jul 10 '14 09:07 dbu

Of course I would, if I was familiar with the doctrine codebase. I'd probably have to take a deep dive over a week. Meanwhile can you tell me pointing out any other way of doing large data processing with doctrine odm, and shouldn't detach free up the document objects to get garbage collected?

Regards, Juzer Ali http://about.me/juzerali

On Thu, Jul 10, 2014 at 3:27 PM, David Buchmann [email protected] wrote:

you are welcome to do a PR to implement the feature ;-)

— Reply to this email directly or view it on GitHub https://github.com/doctrine/phpcr-odm/issues/425#issuecomment-48585752.

juzerali avatar Jul 10 '14 10:07 juzerali

detach should free the memory normally. are you sure you don't keep any references elsewhere?

you could try to call $dm->clear() to wipe the whole document manager when you are doing batch processing. maybe we have an issue with the detach that we don't free everything. does clear work better?

dbu avatar Jul 10 '14 11:07 dbu

Its all the same.

juzerali avatar Jul 17 '14 19:07 juzerali

if $dm->clear does not help then i strongly suspect that you keep references to the objects somewhere else in your code that prevent garbage collection from working.

dbu avatar Jul 18 '14 08:07 dbu

I am :+1: for this Feature. Combined with the Paginator Class that is implemented in the ORM, we can save lots of memory.

ElectricMaxxx avatar Aug 02 '15 05:08 ElectricMaxxx