Jump to content

Slow Query


iversonm

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.