Received: from oxmail.ox.ac.uk (oxmail4.ox.ac.uk [163.1.2.33]) by hub.org (8.9.3/8.9.3) with ESMTP id QAA59664 for ; Fri, 29 Oct 1999 16:05:19 -0400 (EDT) (envelope-from moray.mcconnachie@computing-services.oxford.ac.uk) Received: from heraldgate2.oucs.ox.ac.uk ([163.1.2.50] helo=frontend2.herald.ox.ac.uk ident=exim) by oxmail.ox.ac.uk with esmtp (Exim 2.10 #1) id 11hIFz-0000ky-00; Fri, 29 Oct 1999 21:04:15 +0100 Received: from max159.public.ox.ac.uk ([192.76.27.159] helo=max1.public.ox.ac.uk) by frontend2.herald.ox.ac.uk with smtp (Exim 2.02 #1) id 11hIFz-0006uv-00; Fri, 29 Oct 1999 21:04:15 +0100 Message-ID: <003101bf2248$76e0d8e0$9f1b4cc0@public.ox.ac.uk> From: "Moray McConnachie" To: , "Roderick A. Anderson" Cc: , References: <199910291812.LAA24162@uno.tksoft.com> Subject: Re: [SQL] trivial problem Date: Fri, 29 Oct 1999 21:02:00 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 ----- Original Message ----- From: To: Roderick A. Anderson Cc: ; Sent: Friday, October 29, 1999 7:12 PM Subject: Re: [SQL] trivial problem > If limit didn't mean "get first 50," there would be no time/effort > saved by specifying a limit. > > I.e. when a limit is specified, the backend looks for matches until it > finds 50 records, and then stops. Eh? I think the questioner meant effectively "in a query with LIMIT and ORDER BY, which takes precedence?". To which the answer appears to be ORDER BY, which surprised me, but is of course very useful. I.e. all sorting is completed, and then the first fifty records are returned. Does that mean that the seek time for a limited, ordered by query is the same as that for an unlimited query? The extra speed gained from the limit only achieved by not having to return the data? Or is there some kind of magic going on to allow it to ignore certain things about the query when a LIMIT is in place?