Re: [SQL] trivial problem

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Moray McConnachie <moray(dot)mcconnachie(at)computing-services(dot)oxford(dot)ac(dot)uk>, tjk(at)tksoft(dot)com, "Roderick A(dot) Anderson" <raanders(at)altoplanos(dot)net>, oleg(at)sai(dot)msu(dot)su, pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] trivial problem
Date: 1999-10-30 00:19:26
Message-ID: 199910300019.UAA24998@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Bruce Momjian 1999-10-30 00:30:48 Re: [SQL] Decimal precsion?
Previous Message Bruce Momjian 1999-10-30 00:01:09 Re: [SQL] Decimal precsion?