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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.