Re: Connection.setReadOnly()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
Cc: Oliver Jowett <oliver(at)opencloud(dot)com>, John R Pierce <pierce(at)hogranch(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Connection.setReadOnly()
Date: 2009-12-11 15:26:26
Message-ID: 17892.1260545186@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Craig Ringer <craig(at)postnewspapers(dot)com(dot)au> writes:
> Does Pg have issues with long-running read-only transactions in
> read-committed mode? Or are they an exception to the usual "avoid
> long-running mostly-idle transactions" guideline?

> Pg doesn't have to worry about retaining old rows in vacuum with such a
> statement, because each new statement creates a new snapshot, so if it's
> idle it effectively has _no_ snapshot and vacuum is free to clear old
> rows. It doesn't need to keep track of anything to roll back, since the
> transaction is read only.

As of 8.4, I think the above statements are true. In prior releases,
transactions just advertised the age of their first snapshot, so an
open transaction created an issue for VACUUM regardless of whether
it was serializable or not. 8.4 has more bookkeeping that allows a
transaction to report that it currently has no live snapshots.

regards, tom lane

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Craig Ringer 2009-12-11 15:39:21 Re: Cheapest way to poll for notifications?
Previous Message Albe Laurenz 2009-12-11 15:20:36 Re: Connection.setReadOnly()