pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alessandro Baretta <a.baretta@barettadeit.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Suspending SELECTs
Date: Mon, 16 Jan 2006 12:51:47 -0500
Message-ID: <9766.1137433907@sss.pgh.pa.us> (raw)
In-Reply-To: <43CB71AC.20203@barettadeit.com>
References: <43CB71AC.20203@barettadeit.com>

Alessandro Baretta <a.baretta@barettadeit.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



view thread (29+ messages)  latest in thread

Message-ID: <9766.1137433907@sss.pgh.pa.us>
Permalink:  ../9766.1137433907@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9766.1137433907@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, a.baretta@barettadeit.com
  Subject: Re: Suspending SELECTs
  In-Reply-To: <9766.1137433907@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox