Welcome Guest, Not a member yet? Register   Sign In
Performance loss large Database
#4

[eluser]ivantcholakov[/eluser]
Code:
foreach($sql->result_array() as $tour) {

This loads all the records within the memory, it is OK for smaller recordsets.

In CI3-dev there is a method unbuffered_row(), see http://ci3docs.cibonfire.com/database/results.html

I think, it cycles the returned recordset directly.

Code:
$query = $this->db->query("YOUR QUERY");

while ($row = $query->unbuffered_row())
{
        echo $row->title;
        echo $row->name;
        echo $row->body;
}

// Variations, see the documentation:
// $query->unbuffered_row();               // object
// $query->unbuffered_row('object');       // object
// $query->unbuffered_row('array');        // associative array


Messages In This Thread
Performance loss large Database - by El Forum - 10-19-2014, 08:23 AM
Performance loss large Database - by El Forum - 10-19-2014, 11:25 AM
Performance loss large Database - by El Forum - 10-19-2014, 11:26 AM
Performance loss large Database - by El Forum - 10-19-2014, 02:52 PM
Performance loss large Database - by El Forum - 10-19-2014, 05:00 PM
Performance loss large Database - by El Forum - 10-20-2014, 12:55 AM
Performance loss large Database - by El Forum - 10-20-2014, 05:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB