pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Moray McConnachie <moray.mcconnachie@computing-services.oxford.ac.uk>
To: tjk@tksoft.com
To: Roderick A. Anderson <raanders@altoplanos.net>
Cc: oleg@sai.msu.su
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] trivial problem
Date: Fri, 29 Oct 1999 21:02:00 +0100
Message-ID: <003101bf2248$76e0d8e0$9f1b4cc0@public.ox.ac.uk> (raw)
References: <199910291812.LAA24162@uno.tksoft.com>


----- Original Message -----
From: <tjk@tksoft.com>
To: Roderick A. Anderson <raanders@altoplanos.net>
Cc: <oleg@sai.msu.su>; <pgsql-sql@postgreSQL.org>
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?




view thread (9+ messages)  latest in thread

Message-ID: <003101bf2248$76e0d8e0$9f1b4cc0@public.ox.ac.uk>
Permalink:  ../003101bf2248$76e0d8e0$9f1b4cc0@public.ox.ac.uk/
Also on:    postgresql.org/message-id/003101bf2248$76e0d8e0$9f1b4cc0@public.ox.ac.uk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: moray.mcconnachie@computing-services.oxford.ac.uk, tjk@tksoft.com, raanders@altoplanos.net, oleg@sai.msu.su
  Subject: Re: [SQL] trivial problem
  In-Reply-To: <003101bf2248$76e0d8e0$9f1b4cc0@public.ox.ac.uk>
  References: <199910291812.LAA24162@uno.tksoft.com> <003101bf2248$76e0d8e0$9f1b4cc0@public.ox.ac.uk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox