Allowed memory size exhausted


I have a problem with my page which is returning next error: PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 415006 bytes) in …/YiiRoot/framework/db/CDbCommand.php on line 516, referer: …YiiRoot/epmo/index.php?r=osnovnoSredstvo/admin

I think that the error is caused by a lot of data loading from database. Users were instructed to attach PDF files and I am saving them directly into the database. I know it may be a stupid decision, but that is the decision I made at the begining.

Now I’m searching for information if I can only load data from model that I need on the list (ID, Name, location, etc.) and load PDF files only when opening a single line from that list. Is that even possible? Is there any other solution to this problem.

Thank you all for all the ideas in advance.

You may want to use DAO for the initial search.

Using Active Record it’s possible to specify fields in the CDbCriteria ‘select’ property but it might use to much memory.