It take 40 seconds to display data on the browser, that is not unacceptable.
Code below, it display all the from category.takeawayID=xxxxx and loop in items and options tables.
categories table: over 15,000 rows total
items table: over 100,000 rows
item_options table: over 150,000 rows.
How to improve the performance?
$qcat = mysql_query("select * from categories where takeawayID=55276");
while($c_row = mysql_fetch_assoc($qcat))
{
echo "<h2>" . $c_row['name'] . "</h2>";
echo "<div>" . $c_row['description'] . "</div><br /> <br />";
$qitem = mysql_query("select * from items where category_id =". $c_row['id']);
while($i_row = mysql_fetch_assoc($qitem)) {
echo "<div style='backround-color:pink'>" . $i_row['name'] . "</div>";
$qoption = mysql_query("select * from item_options where item_id =". $i_row['id']);
while($o_row = mysql_fetch_assoc($qoption)) {
echo " (" . $o_row['price'] . ") ";
}
}
}
Maximum records show between 200 to 500 rows depending on the takeawayID ID
You can make an effort to create a single query using joins and also make sure you have created indexes on the columns.