Re: Suspending SELECTs

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alessandro Baretta <a(dot)baretta(at)barettadeit(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Suspending SELECTs
Date: 2006-01-16 17:51:47
Message-ID: 9766.1137433907@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Alessandro Baretta <a(dot)baretta(at)barettadeit(dot)com> writes:
> I am aware that what I am dreaming of is already available through
> cursors, but in a web application, cursors are bad boys, and should be
> avoided. What I would like to be able to do is to plan a query and run
> the plan to retreive a limited number of rows as well as the
> executor's state. This way, the burden of maintaining the cursor "on
> hold", between activations of the web resource which uses it, is
> transferred from the DBMS to the web application server,

This is a pipe dream, I'm afraid, as the state of a cursor does not
consist exclusively of bits that can be sent somewhere else and then
retrieved. There are also locks to worry about, as well as the open
transaction itself, and these must stay alive inside the DBMS because
they affect the behavior of other transactions. As an example, once
the cursor's originating transaction closes, there is nothing to stop
other transactions from modifying or removing rows it would have read.

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Alvaro Herrera 2006-01-16 17:57:38 Re: Suspending SELECTs
Previous Message Michael Riess 2006-01-16 16:26:59 Re: Materialized Views