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

Re: AW: selecting from cursor

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at>
Cc: "'Alex Pilosov'" <alex(at)pilosoft(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: AW: selecting from cursor
Date: 2001-07-03 14:12:53
Message-ID: 18210.994169573@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at> writes:
> this.  Given that cursors (are supposed to) support FETCH BACKWARDS,
> I really don't see why they shouldn't be expected to handle ReScan...
>> I thought only scrollable cursors can do that. What if cursor isn't
>> scrollable? Should it error during the execution?

> In PostgreSQL, all cursors are scrollable. The allowed grammar keyword is
> simply ignored. I am actually not sure that this is optimal, since there
> are a few very effective optimizations, that you can do if you know, that 
> ReScan is not needed (like e.g. not storing the result temporarily).

It's worse than that: we don't distinguish plans for cursors from plans
for any other query, hence *all* query plans are supposed to be able to
run backwards.  (In practice, a lot of them don't work :-(.)  Someday
that needs to be improved.  It would be good if the system understood
whether a particular plan node would ever be asked to rescan itself or
run backwards, and could optimize things on that basis.

			regards, tom lane

In response to

pgsql-hackers by date

Next:From: Barry LindDate: 2001-07-03 15:04:48
Subject: Re: [HACKERS] JDBC Support - prepared Statements?
Previous:From: Tom LaneDate: 2001-07-03 14:02:24
Subject: Re: selecting from cursor

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