Re: [SQL] trivial problem - Mailing list pgsql-sql

From Bruce Momjian
Subject Re: [SQL] trivial problem
Date
Msg-id 199910300019.UAA24998@candle.pha.pa.us
Whole thread Raw
In response to Re: [SQL] trivial problem  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
> 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
ORDERBY. If there is an  index that matches the ORDER BY, PostgreSQL may be able to evaluate  only the first few
recordsrequested, 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,
Pennsylvania19026
 


pgsql-sql by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [SQL] Decimal precsion?
Next
From: Bruce Momjian
Date:
Subject: Re: [SQL] Decimal precsion?