From: Bruce Momjian <maillist@candle.pha.pa.us>
To: eric@linux-hw.com
Cc: jeff@remapcorp.com
Cc: hackers@postgreSQL.org
Subject: Re: [HACKERS] What about LIMIT in SELECT ?
Date: Tue, 13 Oct 1998 17:16:54 -0400 (EDT)
Message-ID: <199810132116.RAA11249@candle.pha.pa.us> (raw)
In-Reply-To: <Pine.LNX.3.96.981013161955.30555A-100000@ireland.linux-hw.com>
> Theoretically a cursor is superior to the "LIMIT" clause because you're
> eventually going to want the B's and K's and etc. anyhow -- but only in a
> stateful enviornment. In the stateless web environment, a cursor is
> useless because the connection can close at any time even when you're
> using "persistent" connections (and of course when the connection closes
> the cursor closes).
>
> I wanted very badly to use PostgreSQL for a web project I'm working on,
> but it just wouldn't do the job :-(.
See my other posting mentioning the FAQ item on this subject. If you
are going after only one table(no joins), and have no ORDER BY, we could
short-circuit the evaluation, but how many queries could use LIMIT in
that case? Zero, I think.
What we could do is _if_ there is only one table(no joins), and an index
exists that matches the ORDER BY, we could use the index to
short-circuit the query.
I have added this item to the TODO list:
* Allow LIMIT ability on single-table queries that have no ORDER BY or
a matching index
This looks do-able, and a real win. Would this make web applications
happier? If there is an ORDER BY and no index, or a join, I can't
figure out how we would short-circuit the query.
--
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
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-hackers@postgresql.org
Cc: maillist@candle.pha.pa.us, eric@linux-hw.com, jeff@remapcorp.com, hackers@postgreSQL.org
Subject: Re: [HACKERS] What about LIMIT in SELECT ?
In-Reply-To: <199810132116.RAA11249@candle.pha.pa.us>
References: <Pine.LNX.3.96.981013161955.30555A-100000@ireland.linux-hw.com> <199810132116.RAA11249@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