MySQL Forums
Forum List  »  Newbie

Re: getting a count of records based on inner relationships...?
Posted by: Felix Geerinckx
Date: May 17, 2005 02:02PM

Brian Culler wrote:

> Felix Geerinckx wrote:

> > Brian Culler wrote:
> > > However its taking a rediculous amount of time to run
> >
> > Is your threadid indexed?
> >
>
>
> I'm not sure what that means, how do I check?

Since you have:

... LEFT JOIN forum AS f2 ON f2.threadid = f1.id

you want an index on threadid, so MySQL can find these records quickly.

If you do

DESCRIBE forum;

you want 'MUL' in the key column of the threadid record.

If you haven't, do an

ALTER TABLE forum ADD INDEX (threadid);

and your queries will almost certainly speed up considerably.

--
felix
Please use BBCode to format your messages in this forum.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.