iversonm Posted October 24, 2012 Share Posted October 24, 2012 Hello. Just wondering if someone can tell me how to make this run faster. I need all the fields I am selecting. I am doing a conversion for a forum so what I did was create a table that stores the topic_ids that I have transferred and that is why I call a left join. I am not very good with mysql, just enough to make mistakes. SELECT wowbb_topics.topic_id, wowbb_topics.forum_id, wowbb_topics.poll_id, wowbb_topics.topic_name, wowbb_topics.topic_description, wowbb_topics.topic_views, wowbb_topics.topic_starter_id, wowbb_topics.topic_date_time, wowbb_converted_topics.topic_id AS old_id FROM ultra.wowbb_topics LEFT JOIN Rabbitry.wowbb_converted_topics ON wowbb_topics.topic_id = wowbb_converted_topics.topic_id WHERE wowbb_converted_topics.topic_id IS NULL LIMIT 1 We are look at around 30 seconds to execute this query. Link to comment https://forums.phpfreaks.com/topic/269843-slow-query/ Share on other sites More sharing options...
iversonm Posted October 24, 2012 Author Share Posted October 24, 2012 OK I guess I am not sure if this is the right thing to do but I changed it SELECT wowbb_topics.topic_id FROM ultra.wowbb_topics LEFT JOIN Rabbitry.wowbb_converted_topics USING (topic_id) WHERE wowbb_converted_topics.topic_id IS NULL LIMIT 100 and then I select the variables if I need them. It is executing in under a second now. Link to comment https://forums.phpfreaks.com/topic/269843-slow-query/#findComment-1387367 Share on other sites More sharing options...
fenway Posted October 25, 2012 Share Posted October 25, 2012 EXPLAIN would have helped a lot here. Link to comment https://forums.phpfreaks.com/topic/269843-slow-query/#findComment-1387584 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.