----- Original Message ----- From: "gerald_clark" <[EMAIL PROTECTED]> To: "Andrey Hristov" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, October 23, 2002 6:23 PM Subject: Re: Problem with select.
> > > Andrey Hristov wrote: > > >HI, > >I don't know is it bad or not but I face queries the work quite long time. > > > >the sql is : > > select * from log_answers_index limit 0,10 > > > >and it takes too much time for me to receive the result. > >I got indexes on most of the fields, i got primary key which is > >auto_increment int(11). When I did explain on the query I got this : > >type : ALL > >rows : 123010 > >all other cells are empty. > > > >When I do : > >select * from log_answers_index where log_entry_index between 1 and 10 > >i got type : range > > > >For me it is strange that the primary key is not used when there is LIMIT > > > What would be the point? > Without a WHERE or an ORDER BY, using an index would slow it down. > I am not an expert but I think that when there is not order by the output is sorted on the primary key. So : select * from log_answers_index limit 0,10 and select * from log_ansers_index where log_entry_id between 1 and 10 are no different in the output. But yes as internal work (of mysql) it is quite different. I think that will be useful optimization done by the optimizer. Andrey --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php