Performance loss large Database

#1
[eluser]Unknown[/eluser]
Hi @all,

I am just migrating a project of mine into codeigniter. On one page the user is getting a list of over 300 tours and details of the tours.
So in my basic project I did the mysql-query and just ran a foreach loop and then in the foreach loop another mysql request to get all the details of each tour from a second details table.

Here is my codeigniter approach:
I have a model where all tours are loaded with one query. Foreach result in this query I do a
foreach($sql->result_array() as $tour) {
$tourarray[$tour['tourid']] = $tour;
and than again a subquery for the details which ends in a multidimensional array called $tourarray with a key per tour and then another subarray with all the details.
I return the $tourarray to the controller which loads the view.
In the view I have to go through the whole array again which ends up in ~6 seconds of loading time where my basic setup which did the same needed less than two.

Is there any shorter way to get a mysql result from a model to a view in codeigniter or is my approach totally wrong?

Thank you very much for your help.
Max


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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.