MySQL Forums
Forum List  »  PHP

Time-out problem
Posted by: Lucas Sartori
Date: April 23, 2014 08:04AM

Hello!

I have 3 tables: spd_unit, spd_ad and spd_campaign.. I'm using Innodb, the index and fk relations are correct.

But the table spd_unit, have more them 2.000.000 rows... so the browser give me time-out error when I try to execute this block of code:

$campaigns = mysql_query('select id_campaign from spd_campaign');
while($campaingsA = mysql_fetch_array($campaigns)){
$formatQ = mysql_query('select fk_id_ad_format from spd_unit join spd_ad on fk_id_ad = id_ad where fk_id_campaign = '.$campaingsA['id_campaign'].' group by fk_id_ad_format');
while($formatA = mysql_fetch_array($formatQ)){
echo 'campaign --> '.$campaingsA['id_campaign'].' | format ->> '.$formatA['fk_id_ad_format'].'<br>';
}
}

In my application I use Yii Framework, where I created a function to run this query to a especific campaign passed by parameter... The code above is just a test that I made to test query speed. The time of execution is more than 3 minutes

Someone can help me with this?

Options: ReplyQuote


Subject
Written By
Posted
Time-out problem
April 23, 2014 08:04AM
April 23, 2014 09:57AM
April 23, 2014 10:27AM
April 25, 2014 02:26PM
April 28, 2014 11:49AM
April 30, 2014 11:15AM
April 30, 2014 11:32AM
April 30, 2014 11:47AM
May 01, 2014 08:00AM
April 30, 2014 01:12PM
May 02, 2014 10:40AM
June 06, 2014 05:13AM
June 06, 2014 09:15AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.