Forum Moderators: open

Message Too Old, No Replies

Index, used with GROUP by

Mysql

         

Anyango

5:33 pm on Aug 31, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey, here is a simple query

select count(*) as c,keyword from mytable where keyword <> '' group by keyword

table is simple, lets say it only has two fields: id and keyword.

I have made an index on keyword, BUT when i run EXPLAIN on that Query it tells me that my index was used but under the "rows" heading it shows the number of all the rows present in my table, worst case scenario. Why is that so that even when my index is being used it is still looking all the records to decide?

What am i doing wrong

Anyango

5:10 pm on Sep 1, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



and "Extra" Heading says
Using Index