Hello I am having problems in optimizing a simple order by clause.
the query is:
explain SELECT `Entity`.`title`, `Entity`.`description`, `Entity`.`user_id`, `Entity`.`thumb_url`, `Entity`.`entity_uid`, `Entity`.`num_fachaks`, `Entity`.`number_of_views` FROM `entities` AS `Entity` ORDER BY `Entity`.`created` DESC LIMIT 21 \G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: Entity
type: ALL
possible_keys: NULL
key: NULL
key_len: NULL
ref: NULL
rows: 11
Extra: Using filesort
I have index on the created filed by really dont understand that why mysql does not use it and prefers file sort.. the created field is a timestamp default current_timestamp.
Please help ... i am new to mysql and badly stuck.
Thanks.
the query is:
explain SELECT `Entity`.`title`, `Entity`.`description`, `Entity`.`user_id`, `Entity`.`thumb_url`, `Entity`.`entity_uid`, `Entity`.`num_fachaks`, `Entity`.`number_of_views` FROM `entities` AS `Entity` ORDER BY `Entity`.`created` DESC LIMIT 21 \G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: Entity
type: ALL
possible_keys: NULL
key: NULL
key_len: NULL
ref: NULL
rows: 11
Extra: Using filesort
I have index on the created filed by really dont understand that why mysql does not use it and prefers file sort.. the created field is a timestamp default current_timestamp.
Please help ... i am new to mysql and badly stuck.
Thanks.
Comment