MySQL Forums
Forum List  »  Newbie

Re: index is not used why?
Posted by: Thomas Jüntgen
Date: March 24, 2009 08:09AM

Thanks for your answer!
The original query scan 15710 rows of 15710 rows.

Your first solution is doing the following

scan 15710 rows of 15710 (type =ALL)
scan 11783 rows of 15710 (type =ALL)
scan 198 rows of 15710 (type=ref)


Your second solution
scan 15710 rows of 15710 (type =index, used key=IDX_RESOURCE_GROUP)
scan 1 rows of 15710 (type =ref, used key=PRIMARY)

Regarding your question of ROW_FORMAT=FIXED. I read that this format could be useful for performance.

Anyway both solution are not faster then the first query.
Also this Query
select c_id
FROM t_event_calendar a
WHERE (a.n_resource_id = 4
OR a.n_group_id IN (1)
OR ( a.n_group_id IS NULL
AND a.n_resource_id IS NULL))
scan 15710 rows of 15710 (type =index, used key=IDX_RESOURCE_GROUP)
result 15224 rows
Why does MySQL think to scan all rows instead using the key?

Thanks for your help
Thomas

Options: ReplyQuote


Subject
Written By
Posted
March 18, 2009 05:32AM
March 19, 2009 07:45PM
Re: index is not used why?
March 24, 2009 08:09AM
March 24, 2009 08:15AM
March 24, 2009 08:11PM
March 24, 2009 08:34PM


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.