MySQL Forums
Forum List  »  Optimizer & Parser

mysql dont use my Index?
Posted by: Johannes Fosseus
Date: January 12, 2006 08:22AM

Hi

I do have this sql-question and when I run 'explain' on this i can see it uses all rows in the table, rows = 86771, and mysql tell me that there is a possible key, 'writerid' and that it uses NULL key. Not good for my perfonmance!

Well, the thing is that I have an index in the junior_text, writerid INDEX?

Anyone have a clue why mysql dont use that index?


---------------------
table type possible_keys key key_len ref rows Extra
junior_text ALL writerid NULL NULL NULL 86771 Using where; Using temporary; Using filesort
junior_writer eq_ref PRIMARY PRIMARY 4 junior_text.writerid 1 Using where

my sql:
EXPLAIN SELECT junior_text.textid, junior_text.texthead, junior_text.textcreatedlong, junior_text.commentnbr, junior_writer.writerid, junior_writer.writername, junior_writer.status
FROM junior_text, junior_writer
WHERE junior_text.textactive =1
AND junior_text.writerid = junior_writer.writerid
AND DATE_FORMAT( junior_text.textcreatedlong, '%Y-%m-%d' ) = '2006-01-12'
AND junior_writer.hidden =0
AND junior_text.foldersid NOT IN ( 28 )
GROUP BY junior_text.textid
ORDER BY textcreatedlong DESC

regards Johannes.



Edited 4 time(s). Last edit at 01/12/2006 08:25AM by Johannes Fosseus.

Options: ReplyQuote


Subject
Views
Written By
Posted
mysql dont use my Index?
2839
January 12, 2006 08:22AM
1988
January 18, 2006 10:36PM


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.