
Is the LIMIT feature very efficient? I want to start using it for quite
a few things, but I'm wondering, what happens when I have a zillion
records and I want the first 10, is that going to be an efficient thing
to do?

-- 
Chris Bitmead
http://www.bigfoot.com/~chris.bitmead
mailto:chris.bitmead@bigfoot.com

Sun, 25 Apr 1999 08:16:58 +0000
Chris Bitmead <chris.bitmead@bigfoot.com>
Efficiency of LIMIT ?
On Sun, Apr 25, 1999 at 08:16:58AM +0000, Chris Bitmead wrote:
> 
> Is the LIMIT feature very efficient? I want to start using it for quite
> a few things, but I'm wondering, what happens when I have a zillion
> records and I want the first 10, is that going to be an efficient thing
> to do?

	I am curious about this myself.  As far as I can tell, it doesn't
give anything that cursors don't provide, but introduces more "features"
into the parser.  Do we need this?


Sun, 25 Apr 1999 11:49:46 -0700
Adam Haberlach <haberlaa@ricochet.net>
Re: [HACKERS] Efficiency of LIMIT ?
> On Sun, Apr 25, 1999 at 08:16:58AM +0000, Chris Bitmead wrote:
> > 
> > Is the LIMIT feature very efficient? I want to start using it for quite
> > a few things, but I'm wondering, what happens when I have a zillion
> > records and I want the first 10, is that going to be an efficient thing
> > to do?
> 
> 	I am curious about this myself.  As far as I can tell, it doesn't
> give anything that cursors don't provide, but introduces more "features"
> into the parser.  Do we need this?

This is pretty correct, though it stops the executor from completing all
the result queries, while cursors don't.  The complete the entire query
and store the result for later fetches..  We support it because MySQL
users and others asked for it.

-- 
  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

Sun, 25 Apr 1999 15:41:29 -0400 (EDT)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Efficiency of LIMIT ?

Here is Tom's comment on the issue.


> Chris Bitmead <chris.bitmead@bigfoot.com> writes:
> > Following is I believe evidence of a pretty bad bug in postgres. This is
> > the 990329 snapshot.
> 
> > httpd=> insert into category(name, image, parent) SELECT 'boo', 'boo',
> > oid FROM category* where name = 'foo';
> > INSERT 158370 1
> > httpd=> select * from category;
> > name    |image|url|parent
> > --------+-----+---+------
> > foo     |foo  |   |     0
> > bar     |bar  |   |158321
> > Products|.gif |   |      
> > (3 rows)
> 
> > Ok, what's going on here. The 'boo' record did not appear!
> 
> Interesting.  You'll notice the INSERT response claims that a tuple was
> inserted, and even gives you the OID for it.  Wonder where it went?
> 
> Anyway, that sure suggests that the SELECT part worked, and the problem
> is that the new tuple got dropped on the floor later.  (Or could it have
> been inserted into another table?  Are there other tables that category*
> includes?)
> 
> I'm guessing this has something to do with Vadim's recent work, but
> I don't pretend to know what's wrong...
> 
> 			regards, tom lane
> 
> 


-- 
  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

Mon, 10 May 1999 11:49:26 -0400 (EDT)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Pretty bad bug in Postgres.
Chris Bitmead <chris.bitmead@bigfoot.com> writes:
>> Following is I believe evidence of a pretty bad bug in postgres. This is
>> the 990329 snapshot.

>> httpd=> insert into category(name, image, parent) SELECT 'boo', 'boo',
>> oid FROM category* where name = 'foo';
>> INSERT 158370 1
>> httpd=> select * from category;
>> name    |image|url|parent
>> --------+-----+---+------
>> foo     |foo  |   |     0
>> bar     |bar  |   |158321
>> Products|.gif |   |      
>> (3 rows)

>> Ok, what's going on here. The 'boo' record did not appear!

Chris, I can't reproduce this here anymore --- do you still see it with
current sources?

			regards, tom lane

Mon, 07 Jun 1999 18:52:37 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] Pretty bad bug in Postgres. 