I am having a problem with a MySQL query. When ever I run this query it takes over 10 seconds to return the rows. However if I change my limit to 29 it returns it in less than 1 second. My Question is my implementation and query in good shape, or am I making a mistake here that would cause this issue?
<?
try
{
$con = mysql_connect("XXX.XXX.XXX.XXX","XXX","XXX");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("bis_co", $con);
$query = "SELECT Name, Value FROM `bis_co`.`departments` LIMIT 31";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
while($row = mysql_fetch_assoc($result)){
echo $row['Name'] . "<br />";
}
mysql_close($con);
}
catch(Exception $e)
{
echo $e;
}
?>
EXPLAIN SELECT Name, Value FROM bis_co.departments LIMIT 311 SIMPLE Departments ALL NULL NULL NULL NULL 51With the Columns being id, select_type, table, type, possible_keys, key, key_len, ref, rows, Extra(which isnt null but has no value)