Skip site navigation (1) Skip section navigation (2)

Re: pg_last_xact_insert_timestamp

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Chris Redekop <chris(at)replicon(dot)com>
Subject: Re: pg_last_xact_insert_timestamp
Date: 2011-09-09 15:32:46
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Thu, Sep 8, 2011 at 8:42 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)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
The Enterprise PostgreSQL Company

In response to


pgsql-hackers by date

Next:From: Kohei KaigaiDate: 2011-09-09 17:01:40
Subject: Re: force_not_null option support for file_fdw
Previous:From: Bernd HelmleDate: 2011-09-09 15:30:02
Subject: Re: Patch to improve reliability of postgresql on linux nfs

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group