I’m using below mentioned query with about 400,000 records in each table its taking about 10~12 seconds to give results. Is there any way I can make it faster.
Query:
select url_details.title, url_details.summary, url_details.id from urls,
url_details where urls.status='' AND urls.keyword_id='2791' AND
url_details.url_id=urls.id
The answer to almost all mysql performance problems are indexes.
If you know that you’ll be filtering on these three variables for all of your queries, add a complex index that spans those three fields.
http://dev.mysql.com/doc/refman/5.0/en/multiple-column-indexes.html
If you will have no idea which indexes will be filtered upon, then add a simple index for each field, and rely on mysql’s “index merge” optimization.
http://dev.mysql.com/doc/refman/5.0/en/index-merge-optimization.html