MySQL Forums
Forum List  »  Performance

MySQL Explain rows limit
Posted by: Raza Shah
Date: October 13, 2013 02:06AM

Hi
Does mysql LIMIT is taken into account when estimating number of rows in Explain?
I have below query to get records with genre_id = 1 from content table. There are total 654 records in the table with genre_id 1. I have index on post_id.

SELECT * FROM (`content`)
WHERE `genre_id ` = '1'
AND `category` = 1
LIMIT 20

And EXPLAIN output:
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE content ref genre_id genre_id 4 const 654 Using where

Now if you notice in explain it is returning 654 rows count, should not it limit to 20 instead getting all those rows?

Stackoverflow:
http://stackoverflow.com/questions/19334640/mysql-explain-rows-limit

Thanks for any help.

Options: ReplyQuote


Subject
Views
Written By
Posted
MySQL Explain rows limit
2203
October 13, 2013 02:06AM
851
October 13, 2013 11:55PM
619
October 15, 2013 07:46AM


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.