At 8:31 PM +0200 8/11/99, Christian Mack wrote:
>tonu-mysql@stripped wrote:
>>
>> On Wed, 11 Aug 1999, Paul McAvoy wrote:
>>
>> > Hi, I am currently using Mysql 3.22.25-1 (RPM). I think that I
>>may have found
>> > a bug, or it may be that I am unclear on how the select statement works.
>> >
>> > My Query is similar to this:
>> >
>> > SELECT id,name FROM list ORDER BY name LIMIT 20;
>> >
>> > I was under the impression that teh LIMIT clause was used to limit the
>> > return set.
>>
>> Yes, it must work like you understood. It must order all items in your
>> table and THEN take the first 20 records and give them back. If it does
>> something different, then it's wrong.
>>
>> Tonu
>
>Hi
>
>Mysql doesn't do this.
>As described in the manual mysql will stop getting results, when it
>reached the given amount.
>It will only satisfy the WHERE part of your query.
>The ordering is done after getting the results.
>So you get with the above SELECT 20 rows which are ordered, not the
>first 20 from the ordered list.
?
Are you sure about that? I thought that LIMIT was something like
HAVING in that
it post-processes the result set after having determined what the result set
was.
If that's not so, then why does a LIMIT 20 query on a table with a zillion rows
take longer than on a table with a few rows?
--
Paul DuBois, paul@stripped