Re: I cant find it or I'm just lazy ?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Darko Prenosil <darko(dot)prenosil(at)finteh(dot)hr>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: I cant find it or I'm just lazy ?
Date: 2003-03-07 20:03:03
Message-ID: 2187.1047067383@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> What I think you are seeing are that certain cursors can't go backwards.

Lots of the more complex plan node types don't correctly implement
backwards fetch. I've looked briefly at fixing that, but it looks like
it'd be a major pain in the rear for some cases, such as Agg nodes.

A stopgap I've been considering is to add code that knows which plan node
types can go backwards. Then, if the cursor logic needs to go backwards
on a plan type that doesn't support it, it could instead rewind to start
(all plan types seem to support Rescan) and step forwards the correct
number of rows. This could be horribly inefficient but at least it
would work.

A less inefficient solution would be to stick a Materialize node atop
the plan, but the trouble is that would be a huge penalty for the common
cases where no backwards scan is actually ever done. Maybe we could
have the cursor logic insert the Materialize node on-the-fly when the
first backwards motion command is received. Also, we could implement
the SQL keyword "SCROLL" and say that you have to specify SCROLL if you
don't want this extra work to occur (with SCROLL, we could insert
Materialize if needed before starting).

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-03-07 20:05:12 Re: division by zero
Previous Message Eric B.Ridge 2003-03-07 19:58:53 Re: division by zero