Re: Optimising Time to Output Listings from a Search
Hi,
The first (and most likely worst!) thing I see is:
result = mysql_query("$querystring;",$link);
$num_rows = mysql_num_rows($result);
and then doing it again with LIMIT.
Basically imagine you have 50,000 rows that match. In the first one you are retrieving 50000 rows, and then the first few again. That is extremely inefficient.
To get the number of matching rows you should either use the SQL_CALC_FOUND_ROWS functionality or use a COUNT(*) to find the number instead. That way you aren't retrieving a huge result set for no reason at all.
Of course many of your other ideas might increase performance as well, but I think this would be the most significant thing you could do.
Harrison Fisk, Trainer and Consultant
MySQL AB, www.mysql.com
Subject
Views
Written By
Posted
2495
March 01, 2005 12:10AM
Re: Optimising Time to Output Listings from a Search
1788
March 03, 2005 07:42PM
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.