Skip site navigation (1) Skip section navigation (2)

Re: AW: LIMIT in DECLARE CURSOR: request for comments

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at>
Cc: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: AW: LIMIT in DECLARE CURSOR: request for comments
Date: 2000-10-30 17:07:36
Message-ID: Pine.BSF.4.10.10010300901310.55394-100000@megazone23.bigpanda.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Mon, 30 Oct 2000, Zeugswetter Andreas SB wrote:

> 
> > After thinking some more about yesterday's discussions, I propose that
> > we adopt the following planning behavior for cursors:
> > 
> > 1. If DECLARE CURSOR does not contain a LIMIT, continue to plan on the
> > basis of 10%-or-so fetch (I'd consider anywhere from 5% to 25% to be
> > just as reasonable, if people want to argue about the exact number;
> > perhaps a SET variable is in order?).  10% seems to be a reasonable
> > compromise between delivering tuples promptly and not choosing a plan
> > that will take forever if the user fetches the whole result.
> 
> Imho that was a wrong assumption in the first place. The default assumption 
> imho needs to be 100 %. Especially if you fixed the limit clause enabling people
> to optimize the few rows fetched case.

But what if you're doing fetch 10 rows, fetch 10 rows, ...
You're not limiting, because you want all of them, but you are only
pulling a small number at a time to say do expensive front end processing.
It might make sense to actually pull a plan which is lower startup and
higher per row.  Although the full cost is higher, you get a better
turnaround time on the first set and the cost difference per set may
be unnoticeable (it would depend on the particulars).


In response to

pgsql-hackers by date

Next:From: Peter MountDate: 2000-10-30 17:10:40
Subject: Re: Current CVS broken?
Previous:From: Peter EisentrautDate: 2000-10-30 16:58:16
Subject: Re: CC not getting -O passed?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group