Allowed memory exhausted

Hello,

Im trying to fetch all the users in my Model by doing a simple Users::find() and I keep on getting a fatal error, Allowed memory exhausted, I have 512MB, which I believe should be sufficient, it shouldn't need more.

Other feches on smaller tables return results, so it's a problem of the size of the result fetched.



11.1k

How big is the table?



1.1k

It has 65.000 rows, it also happens to me when I fetch in a model with 16.000 rows, it doesnt when I fetch smaller ones.

2015-02-26 2:58 GMT+01:00 Max Castro <phosphorum@phalconphp.com>:

How big is the table?

— Reply to this email directly or view the complete thread on Phosphorum <http://forum.phalconphp.com/discussion/6022/allowed-memory-exhausted#C16187>. Change your e-mail preferences here <http://forum.phalconphp.com/settings>

-- David Shaikh Urbina Mobile: (+34) 647 727 132 Mail: david@wasabiappfactory.com Web: www.wasabiappfactory.com

This email and its attached files are confidential. Any kind of distribution or publication of its content is not allowed and needs the prior consent of Wasabi App Factory SL. Advertencia/Confidentiality Notice <http://www.wasabiappfactory.com/advertenciaconfidentiality-notice/>



11.1k

Yeah, but how big in megas is the tables? also paste the code plz.

Thanks



7.2k

This is a feature of PDO driver PHP.

You can use sparing algorithms.

Or use msqli driver.

See : http://forum.phalconphp.com/discussion/3793/phalcon-resultsets-and-large-mysql-tables



1.1k

It's 1.57GB, I didnt realise how big it was.

The code is a simple $usersNewbies = Users::find();, you need something more?

Yeah, but how big in megas is the tables? also paste the code plz.

Thanks

— Reply to this email directly or view the complete thread on Phosphorum <http://forum.phalconphp.com/discussion/6022/allowed-memory-exhausted#C16196>. Change your e-mail preferences here <http://forum.phalconphp.com/settings>

-- David Shaikh Urbina Mobile: (+34) 647 727 132 Mail: david@wasabiappfactory.com Web: www.wasabiappfactory.com

This email and its attached files are confidential. Any kind of distribution or publication of its content is not allowed and needs the prior consent of Wasabi App Factory SL. Advertencia/Confidentiality Notice <http://www.wasabiappfactory.com/advertenciaconfidentiality-notice/>



11.1k

@subhard did @Oleg suggestion work?



1.1k

Changing to mysqli wasnt an option for us.

I tried several ways, and apparently using Users::find(); involves bringing all the data from the table and that uses all the memory when it's a big table. I suposed phalcon would optimize that. Using Users::find(array("columns" => idUser)); made the query faster and it didnt use all the memory. But I ended up using Depency Injector and mysql querys, which are very fast and also don't use up all the memory.