pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <maillist@candle.pha.pa.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Moray McConnachie <moray.mcconnachie@computing-services.oxford.ac.uk>
Cc: tjk@tksoft.com, "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 20:19:26 -0400 (EDT)
Message-ID: <199910300019.UAA24998@candle.pha.pa.us> (raw)
In-Reply-To: <3670.941240269@sss.pgh.pa.us>

> Bruce Momjian <maillist@candle.pha.pa.us> writes:
> > FAQ says:
> > See the <I>fetch</I> manual page, or use SELECT ... LIMIT....<P>
> 
> > This only prevents all row results from being transferred to the client.
> > The entire query must be evaluated, even if you only want just the first
> > few rows. Consider a query that has an <I>order by.</I>  There is no way
> > to return any rows until the entire query is evaluated and sorted.<P>
> 
> That FAQ entry is not right.  It might be right for FETCH, but not for
> SELECT ... LIMIT.  With a LIMIT, the executor will stop once it has
> generated the requested number of rows.  Of course, how much computation
> is needed to reach that point depends greatly on the query and the query
> plan.

New FAQ text is:

   The entire query may have to be evaluated, even if you only want the
   first few rows. Consider a query that has an ORDER BY. If there is an
   index that matches the ORDER BY, PostgreSQL may be able to evaluate
   only the first few records requested, or the entire query may have to
   be evaluated until the desired rows have been generated.
   

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



view thread (9+ messages)

Message-ID: <199910300019.UAA24998@candle.pha.pa.us>
Permalink:  ../199910300019.UAA24998@candle.pha.pa.us/
Also on:    postgresql.org/message-id/199910300019.UAA24998@candle.pha.pa.us

 · 

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: maillist@candle.pha.pa.us, tgl@sss.pgh.pa.us, moray.mcconnachie@computing-services.oxford.ac.uk, raanders@altoplanos.net, oleg@sai.msu.su
  Subject: Re: [SQL] trivial problem
  In-Reply-To: <199910300019.UAA24998@candle.pha.pa.us>
  References: <3670.941240269@sss.pgh.pa.us> <199910300019.UAA24998@candle.pha.pa.us>

* 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