php - Large SQL result set taking too much memory - CodeIgniter -
php - Large SQL result set taking too much memory - CodeIgniter -
i issuing sql query using codeigniter can homecoming upwards of 80,000 rows results. each row has 3 columns of integers, , getting php error: fatal error: allowed memory size of 134217728 bytes exhausted
it seems trying utilize more 128mb retrieve results mysql server. using $query->result_array() retrieve results. there serious overhead in terms of space in results getting. retrieve 100,000 rows, 3 integers. 100,000*((3*4 + 10)= 2.1mb. (the 10 number of bytes used column id etc).
am doing wrong?
----------------------solved-----------------------
solved modifying codeigniter code: link.
execution faster , script taking ~3mb of memory instead of upwards of 128mb.
i'm not sure how ci returns results, don't want entire info set in single array. why not loop through each row needed?
<?php $result = $this->db->query('select ...'); while($row = $result->next_row()) { // single row }
php mysql sql codeigniter
Comments
Post a Comment