I am having BIG problems with pageload times when executing the following query:
PHP Code:
$queryvenues = $db->query_read("
SELECT " . TABLE_PREFIX . "erc_venue.*, " . TABLE_PREFIX . "dma.*
FROM " . TABLE_PREFIX . "erc_venue
LEFT JOIN " . TABLE_PREFIX . "dma ON " . TABLE_PREFIX . "dma.zipcode = " . TABLE_PREFIX . "erc_venue.venuezipcode
ORDER BY " . TABLE_PREFIX . "erc_venue.venuetitle
");
Just to give you all an idea of my db, the erc_venue table contains more than 1,000 records and the dma table contains more than 60,000 records...
FYI, the function i have created to display the results is as follows:
PHP Code:
function print_venue_row($venue)
{
if ($venue['venuecountry'] = 'USA' AND $venue['venuezipcode'] != 0)
{
$venuedma = $venue['dmaname_clean'] . " (" . $venue['rank'] . ")";
}
else
{
$venuedma = '';
}
print_cells_row(array(
"<a href=\"erc_editvenue.php?venueid=".$venue['venueid']."\">".$venue['venuetitle']."</a>",
$venue['venuecitystate'],
$venuedma,
$venue['venueid'],
"<a href=\"".$venue['venueurl']."\" target=\"_blank\"><img src=\"../images/buttons/ip.gif\" alt=\"".$venue['venueurl']."\" border=\"0\" /></a>",
"<input type=\"radio\" name=\"idforaction\" value=\"".$venue['venueid']."\">"
));
}
When executing this query, it can take as long as 122 seconds to load the page! Is there any way I could re-write the query (or the function print_venue_row) more efficiently to help load the page more quickly?
Thanks in advance for your assistance