Re: pg_last_xact_insert_timestamp - Mailing list pgsql-hackers

From Robert Haas
Subject Re: pg_last_xact_insert_timestamp
Date
Msg-id CA+TgmoYOij4ryMZHNKfOQjS5BQO8gy36j2=XCNjMte9ZWAFvsQ@mail.gmail.com
Whole thread Raw
In response to Re: pg_last_xact_insert_timestamp  (Fujii Masao <masao.fujii@gmail.com>)
Responses Re: pg_last_xact_insert_timestamp
List pgsql-hackers
On Thu, Sep 8, 2011 at 8:42 PM, Fujii Masao <masao.fujii@gmail.com> wrote:
> Another idea to avoid spinlock contention is save the timestamp in
> PgBackendStatus (which contains information for pg_stat_activity).
> This enables us to write and read the timestamp without spinlock.
> Comments?

That seems like a possibly promising approach, in that each backend
could update the information separately, and it's the reader's job to
go find the maximum of all those values when needed.  So the overhead
is (properly, in this case) placed on the reader instead of the
writer.  But it's a bit tricky, because when the reader wants that
maximum, it has to take into account inactive backends that may have
committed transactions before exiting, not just the ones that are
still connected.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: Bernd Helmle
Date:
Subject: Re: Patch to improve reliability of postgresql on linux nfs
Next
From: Kohei Kaigai
Date:
Subject: Re: force_not_null option support for file_fdw