Jump to content

Needing help with filesort


jcink

Recommended Posts

Hi,

 

SQL version: 4.1.21

 

This query:

 

SELECT t.tid, t.title, t.starter_name, t.starter_id, p.post_date, p.post, p.pid

                                              FROM freeto_topics t

                                      LEFT JOIN freeto_posts p ON (p.new_topic = 1 AND p.topic_id = t.tid)

                                                      WHERE t.forum_id IN (7,3,26)

                                                              AND t.approved=1

                                                      ORDER BY t.tid DESC

                                                      LIMIT 0, 15

 

is used on a forum. it seems to be doing a filesort. here is the EXPLAIN for this query:

 

id  select_type  table  type  possible_keys  key  key_len  ref  rows  Extra

1 SIMPLE t range forum_id forum_id 4 NULL 23 Using where; Using filesort

1 SIMPLE p ref topic_id topic_id 4 freeto.t.tid 49

 

How can I get rid of this...? forum_id has an index on tid so I dont understand why it's doing a file sort. More info can be posted if needed, I'm confused with this index stuff and I've read the manuals, but I need some help.

 

Thanks in advance.

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.