Re: cursors outside transactions

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Dave Cramer <Dave(at)micro-automation(dot)net>, Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>, Neil Conway <neilc(at)samurai(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: cursors outside transactions
Date: 2003-03-19 04:50:25
Message-ID: 20030319045025.GA6477@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 18, 2003 at 11:36:22PM -0500, Bruce Momjian wrote:
> Tom Lane wrote:
> > Dave Cramer <Dave(at)micro-automation(dot)net> writes:
> > > On Tue, 2003-03-18 at 19:00, Hiroshi Inoue wrote:
> > >> ODBC(maybe JDBC also) has cross-transaction result sets
> > >> (rather than cursors) since long by simply holding all
> > >> results for a query at client side.
> >
> > > JDBC is running into problems with this. Large queries cause out of
> > > memory exceptions.
> >
> > Cursors implemented as Neil suggests would cause out-of-disk exceptions.
> > The limit is presumably further away than out-of-memory, but not any the
> > less real. I'm concerned about this because, in my mind, one of the
> > principal uses of cursors is to deal with too-huge-to-materialize result
> > sets.
>
> I don't see how you can class out of memory in the same likelyhood as
> out of disk --- sure they are both real possible failures, but clearly
> the latter is more rare and giving folks backing store for large result
> sets is a big win in my book.

Note that ODBC etc holding all the result can cause an memory outage on
the client side, while Neil's proposal can cause disk outage on the
server side. I remember reading somewhere that disk outage on the
server side can be dangerous (to pg_xlog or whatever).

Maybe the mechanism can be made smart and try to estimate the space it's
going to use?

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Cuando miro a alguien, mas me atrae como cambia que quien es" (J. Binoche)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ronald Kuczek 2003-03-19 06:30:14 Win32 native port
Previous Message Bruce Momjian 2003-03-19 04:36:22 Re: cursors outside transactions