Re: Size of Postgres Transaction Logs - Mailing list pgsql-general

From Tom Lane
Subject Re: Size of Postgres Transaction Logs
Date
Msg-id 28419.990243471@sss.pgh.pa.us
Whole thread Raw
In response to Re: Size of Postgres Transaction Logs  (Lincoln Yeoh <lyeoh@pop.jaring.my>)
List pgsql-general
Lincoln Yeoh <lyeoh@pop.jaring.my> writes:
> So what happens typically is:
> 1) open DB connection.
> 2) wait for http request.
> 3) rollback (to implicitly begin a new transaction so that 'now' isn't
> years ago :) ).
> 4) do DB stuff
> 5) rollback/commit.

> Would we get massive WAL growth if the long running transactions are
> inactive (stuck at step 2) - not doing anything, but other transactions are
> active?

Not if they haven't done anything yet.  "BEGIN" doesn't really start a
transaction, it's only your first database access that gets the
transaction engine running.  Furthermore, if I recall the WAL stuff
correctly, what really counts for WAL is your first *write* access.
A read-only xact doesn't exist as far as WAL is concerned.

Nonetheless, I'm pretty concerned about this log-growth issue.  See
current pghackers thread about whether we really need WAL to provide
UNDO support.  AFAICS, we could truncate the WAL log at each checkpoint
if we didn't need UNDO.

            regards, tom lane

pgsql-general by date:

Previous
From: R Talbot
Date:
Subject: PostgreSql and Caldera
Next
From: Tod McQuillin
Date:
Subject: Re: PostgreSql and Caldera