Re: Question about Idle in TX

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: John R Pierce <pierce(at)hogranch(dot)com>
Cc: David Kerr <dmk(at)mr-paradox(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: Question about Idle in TX
Date: 2010-08-04 05:19:57
Message-ID: 4C58F87D.2040702@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 04/08/10 03:17, John R Pierce wrote:
> On 08/03/10 12:13 PM, David Kerr wrote:
>> I know that Idle in Transactions are a problem, however I'm trying to
>> assess how much of a problem.
>>
>> for example: If a java program connects to the DB and does "begin;"
>> and then internally does a "sleep 6 days"
>>
>> Does that cauz any issues other than eating a connection to the database?
>>
>> (note, nothing i have does this, i'm just trying to understand)
>>
>> I know that "Idle in TXs" can interfere with Vaccums for example, but
>> I'm not sure if that's due to them usually having some form of lock on a
>> table.
>
> no dead tuples created after the oldest active transaction (including
> said <Idle in Transaction>) can be vacuumed, from anywhere in the database.

Is that still true for READ COMMITTED transactions? Because it need not be.

I seem to remember a previous discussion in which it emerged that as of
8.3 or 8.4 Pg is smart enough to realize that an open READ COMMITTED
transaction can't ever refer to tuples from snapshots older than the
currently running statement (if any), so it shouldn't impede vacuum. I
can't seem to find any references for that, though.

For that matter, a SERIALIZABLE transaction only acquires its snapshot
on the first _real_ command (SELECT, etc) so it shouldn't impede VACUUM
if it's just issued a BEGIN and a few SETs. However, I'm not totally
sure it *doesn't* impede vacuum, it just doesn't have to.

--
Craig Ringer

Tech-related writing: http://soapyfrogs.blogspot.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-08-04 05:22:20 Re: PG 8.4 won't start on Windows Server 2008 64-bit
Previous Message Gerd Koenig 2010-08-04 05:16:37 Re: problem with pg_standby