tags:

views:

47

answers:

1

I have a titles table of about 14000 records, with a float field average_rating, which is indexed. But when I try to get the first 48 records with the highest average_rating, the index doesn't do any work. What am I doing wrong?

mysql> explain SELECT * FROM `titles` WHERE (average_rating is not null) \
ORDER BY average_rating desc LIMIT 0, 48\G

*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: titles
         type: range
possible_keys: index_titles_on_average_rating
          key: index_titles_on_average_rating
      key_len: 5
          ref: NULL
         rows: 14114
        Extra: Using where
1 row in set (0.00 sec)
A: 

I'm pretty sure the Explain just is ignoring the LIMIT clause.

MindStalker