ayok Posted May 14, 2012 Share Posted May 14, 2012 Hi, I have a site which is going much slower to download when there are more items. I think it's caused by the queries in the site, but I really don't know which query. Is it the mysql_num_rows? Or searching queries? There is a long "where" filter. Has anyone experienced this? Any suggestions? Thanks, ayok Quote Link to comment Share on other sites More sharing options...
smoseley Posted May 14, 2012 Share Posted May 14, 2012 2 things you can do: 1. You can set up a mysql_slow.log using my.cnf to record slow queries, and 2. You can install mytop to show an active record of which queries are taking the longest Quote Link to comment Share on other sites More sharing options...
ayok Posted May 14, 2012 Author Share Posted May 14, 2012 Hi. Thanks again. I'll try your suggestion. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted May 14, 2012 Share Posted May 14, 2012 try adding the word "explain" before your select statements. It will tell you which keys (if any) it is/isn't using. example: mysql> explain select * from members where member_id = 108649; +----+-------------+---------+-------+---------------+---------+---------+-------+------+-------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+---------+-------+---------------+---------+---------+-------+------+-------+ | 1 | SIMPLE | members | const | PRIMARY | PRIMARY | 4 | const | 1 | | +----+-------------+---------+-------+---------------+---------+---------+-------+------+-------+ you want to look at the column "key" if it is "NULL" you are not using a key, and you should then add one. Paste the query your running, and we can help you choose indexes to use. Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.