robbyc Posted February 12, 2007 Share Posted February 12, 2007 Hi I have a very simple table with three columns an id column type int auto increment, a url column type varchar(500) and serach_term varchar(200). The table has about 50000 rows and I query it by select query_url from invalid_queries where query_url = 'query_url'; This is very slow, I have added an index but this doesn't seem to have helped. Can anyone please tell me how to optimise this table and query? I am actually only concerned with whether the row exists or not and in my php use mysql_num_rows to give me my result, would count(*) be more efficient? Thanks in advance Link to comment https://forums.phpfreaks.com/topic/38189-solved-simple-optimisation/ Share on other sites More sharing options...
shoz Posted February 12, 2007 Share Posted February 12, 2007 Post the CREATE statement for the table and the EXPLAIN for the query SHOW CREATE TABLE tablename EXPLAIN select query_url from invalid_queries where query_url = 'query_url' Link to comment https://forums.phpfreaks.com/topic/38189-solved-simple-optimisation/#findComment-182831 Share on other sites More sharing options...
robbyc Posted February 12, 2007 Author Share Posted February 12, 2007 Hello after further investigation and reading I realised that my index should have made a vast improvement. I had created it using the mysql gui after I deleted it and recreated it using the command line the number of rows being examined dropped from ~30000 to 22. Sorting out the bottleneck in my application. Thanks for you help anyway Link to comment https://forums.phpfreaks.com/topic/38189-solved-simple-optimisation/#findComment-182856 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.