![]() |
Exceeded excution time - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Exceeded excution time (/showthread.php?tid=33487) |
Exceeded excution time - El Forum - 08-27-2010 [eluser]belial.seed[/eluser] Hi i´m having trouble generating a file out of a big resultset, i´ll explain the problem, the code i´m using works for queries that return around 5000 rows and it´s really fast, however when i try the same thing with a bigger resultset (about 4 million rows with 10 fields each), seems like i run out of time so i´ve set max_execution_time=300 on my php.ini, i´ve tried to limit the resultset to half a million, but I still have the same problem, so a little light on my way will be appreciated, thanks for your attention. the code i´m using: Code: $this->load->dbutil(); PS the query takes about 2 minutes to complete. Exceeded excution time - El Forum - 08-27-2010 [eluser]tkyy[/eluser] at the top of the file that has that code, try Code: <?php Exceeded excution time - El Forum - 08-31-2010 [eluser]belial.seed[/eluser] Thanks for your answer tkyy it works, now I have different issue i´m exhausting the allowed memory, i´ve set 512 Mb in the php.ini and i´m only processing 200,000 rows at a time however, when i run the query trying to retrieve the next set of rows the error shows up and seems like the unset function doesn´t free the used memory by the resulset. here´s the code Code: // get the number of rows Exceeded excution time - El Forum - 08-31-2010 [eluser]danmontgomery[/eluser] Try: Code: $this->db->free_result(); Instead of unset(). (Or, in addition to... Leaving it in won't hurt anything) Exceeded excution time - El Forum - 09-01-2010 [eluser]icomefromthenet[/eluser] You can use the undocument method from CI db library this just wrapps to php method, it wont load the entire result object into memory like any of the CI methods do. I found it helps in the past to conserve memory Code: while ($result = $data_row->_fetch_assoc()) { Exceeded excution time - El Forum - 09-01-2010 [eluser]belial.seed[/eluser] Thanks for your answer noctrum however seems like the resultset it´s not being cleared, here is de the Xdebug error log. Code: ( ! ) Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 43 bytes) in C:\xampp\htdocs\gic\gic_qp\aplicacion\database\drivers\mysql\mysql_result.php on line 147 I'm clearing and unsetting like is: Code: $query2->free_result(); Is there a way to clear the resultset the hard way? Exceeded excution time - El Forum - 09-03-2010 [eluser]belial.seed[/eluser] The error was in the query limit the second time it brought back 400 000 rows, thanx for your help. |