pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Have TRUNCATE update pgstat tuple counters
Date: Fri, 20 Feb 2015 15:11:30 +0000
Message-ID: <E1YOpEo-0004pD-7l@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Have TRUNCATE update pgstat tuple counters

This works by keeping a per-subtransaction record of the ins/upd/del
counters before the truncate, and then resetting them; this record is
useful to return to the previous state in case the truncate is rolled
back, either in a subtransaction or whole transaction.  The state is
propagated upwards as subtransactions commit.

When the per-table data is sent to the stats collector, a flag indicates
to reset the live/dead counters to zero as well.

Catalog version bumped due to the change in pgstat format.

Author: Alexander Shulgin
Discussion: 1007.1207238291@sss.pgh.pa.us
Discussion: 548F7D38.2000401@BlueTreble.com
Reviewed-by: Álvaro Herrera, Jim Nasby

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/d42358efb16cc81122c53ffb35ac381b9158e519

Modified Files
--------------
src/backend/commands/tablecmds.c               |    3 +
src/backend/postmaster/pgstat.c                |  110 +++++++++++++++++++++++-
src/include/pgstat.h                           |    6 ++
src/test/regress/expected/prepared_xacts.out   |   50 +++++++++++
src/test/regress/expected/prepared_xacts_1.out |   53 ++++++++++++
src/test/regress/expected/stats.out            |   64 ++++++++++++++
src/test/regress/sql/prepared_xacts.sql        |   27 ++++++
src/test/regress/sql/stats.sql                 |   64 ++++++++++++++
8 files changed, 374 insertions(+), 3 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


view thread (4+ messages)  latest in thread

Message-ID: <E1YOpEo-0004pD-7l@gemulon.postgresql.org>
Permalink:  ../E1YOpEo-0004pD-7l@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1YOpEo-0004pD-7l@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: alvherre@alvh.no-ip.org
  Subject: Re: pgsql: Have TRUNCATE update pgstat tuple counters
  In-Reply-To: <E1YOpEo-0004pD-7l@gemulon.postgresql.org>
  References: <E1YOpEo-0004pD-7l@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox