Received: from candle.pha.pa.us (maillist@s5-03.ppp.op.net [209.152.195.67]) by hub.org (8.8.8/8.8.8) with ESMTP id RAA28983 for ; Tue, 13 Oct 1998 17:16:58 -0400 (EDT) (envelope-from maillist@candle.pha.pa.us) Received: (from maillist@localhost) by candle.pha.pa.us (8.9.0/8.9.0) id RAA11249; Tue, 13 Oct 1998 17:16:54 -0400 (EDT) From: Bruce Momjian Message-Id: <199810132116.RAA11249@candle.pha.pa.us> Subject: Re: [HACKERS] What about LIMIT in SELECT ? In-Reply-To: from Eric Lee Green at "Oct 13, 1998 4:24:20 pm" To: eric@linux-hw.com (Eric Lee Green) Date: Tue, 13 Oct 1998 17:16:54 -0400 (EDT) Cc: jeff@remapcorp.com, hackers@postgreSQL.org X-Mailer: ELM [version 2.4ME+ PL47 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit > 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