Re: OFFSET/LIMIT, cursors, and DAWG scope boundaries

Steve Harris wrote:
> On Wed, Apr 06, 2005 at 03:19:58 +0100, Dave Beckett wrote:
> 
>>On Wed, 6 Apr 2005 08:50:23 -0400, Bijan Parsia <bparsia@isr.umd.edu> wrote:
>>
>>Just answering one thing:
>>
>>
>>>Limit is the "relative" end point. Offset is the actual start point. 
>>>(Hmm. I didn't see any statement forbidding the offset > limit. That 
>>>just returns 0 results?) Both are one shot deals (i.e., they are done 
>>>once in the context of a query).
>>
>>In the current design, the order of the controls is (rq23, sec 10.1)
>>  1. projection 2. distinct 3. order by 4. limit 5. offset
>>(although there are some severe wording problems there that I'll write down
>>in my review)
>>
>>so limit is an absolute number, it counts all solutions, and does not start
>>counting relative to a particular offset.
>>
>>offset applies last and picks the start point from the resulting sequence
>>after steps 1. to 4.
> 
> 
> OK, well thats not what MySQL for one does, it applies offset then limit.
> That seems less supprising to me.

Can change to that order but it makes no difference.

As LIMIT says "max number of answers to return is" (it does not say "0 to the 
Nth") it's setting a property of the results; the order of limit/offset does not 
matter.  Syntax-wise SQL has LIMIT-OFFSET so defining it like that is clearer.

(MySQL originally used a different syntax LIMIT n,m which is rather confusing as 
without the comma, the first number is the m, not the n "LIMIT m".  It supports 
the more common form now.)

	Andy

> 
> - Steve
> 

Received on Monday, 11 April 2005 11:05:51 UTC