pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Have TRUNCATE update pgstat tuple counters
4+ messages / 3 participants
[nested] [flat]

* pgsql: Have TRUNCATE update pgstat tuple counters
@ 2015-02-20 15:11 Alvaro Herrera <alvherre@alvh.no-ip.org>
  2015-02-20 15:23 ` Re: pgsql: Have TRUNCATE update pgstat tuple counters Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Alvaro Herrera @ 2015-02-20 15:11 UTC (permalink / raw)
  To: pgsql-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


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pgsql: Have TRUNCATE update pgstat tuple counters
  2015-02-20 15:11 pgsql: Have TRUNCATE update pgstat tuple counters Alvaro Herrera <alvherre@alvh.no-ip.org>
@ 2015-02-20 15:23 ` Tom Lane <tgl@sss.pgh.pa.us>
  2015-02-20 16:08   ` Re: pgsql: Have TRUNCATE update pgstat tuple counters Alvaro Herrera <alvherre@2ndquadrant.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2015-02-20 15:23 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: pgsql-committers

Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> Have TRUNCATE update pgstat tuple counters

> Catalog version bumped due to the change in pgstat format.

I see no catversion.h change here, which is probably a good thing because
no such bump should have been made for this change anyway.  What *should*
have been altered, and was not, was PGSTAT_FILE_FORMAT_ID.  Please fix.

			regards, tom lane


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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pgsql: Have TRUNCATE update pgstat tuple counters
  2015-02-20 15:11 pgsql: Have TRUNCATE update pgstat tuple counters Alvaro Herrera <alvherre@alvh.no-ip.org>
  2015-02-20 15:23 ` Re: pgsql: Have TRUNCATE update pgstat tuple counters Tom Lane <tgl@sss.pgh.pa.us>
@ 2015-02-20 16:08   ` Alvaro Herrera <alvherre@2ndquadrant.com>
  2015-02-20 16:15     ` Re: pgsql: Have TRUNCATE update pgstat tuple counters Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Alvaro Herrera @ 2015-02-20 16:08 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers

Tom Lane wrote:
> Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> > Have TRUNCATE update pgstat tuple counters
> 
> > Catalog version bumped due to the change in pgstat format.
> 
> I see no catversion.h change here, which is probably a good thing because
> no such bump should have been made for this change anyway.  What *should*
> have been altered, and was not, was PGSTAT_FILE_FORMAT_ID.  Please fix.

Right -- pushed that fix.

Now buildfarm member kouprey is failing the added test in
prepared_xacts.  I am tempted to just remove it rather than try to fix
it: there's a 0.5s sleep in there (not enough for sure), but it would be
annoying to move it to the stats test which already sleeps however much
is necessary, because we would need to add an alternate output for the
case when prepared xacts are not enabled in the server.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pgsql: Have TRUNCATE update pgstat tuple counters
  2015-02-20 15:11 pgsql: Have TRUNCATE update pgstat tuple counters Alvaro Herrera <alvherre@alvh.no-ip.org>
  2015-02-20 15:23 ` Re: pgsql: Have TRUNCATE update pgstat tuple counters Tom Lane <tgl@sss.pgh.pa.us>
  2015-02-20 16:08   ` Re: pgsql: Have TRUNCATE update pgstat tuple counters Alvaro Herrera <alvherre@2ndquadrant.com>
@ 2015-02-20 16:15     ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2015-02-20 16:15 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: pgsql-committers

Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> Now buildfarm member kouprey is failing the added test in
> prepared_xacts.  I am tempted to just remove it rather than try to fix
> it: there's a 0.5s sleep in there (not enough for sure), but it would be
> annoying to move it to the stats test which already sleeps however much
> is necessary, because we would need to add an alternate output for the
> case when prepared xacts are not enabled in the server.

OK with me.  It's not apparent that this behavior has to be memorialized
in a regression test.

			regards, tom lane


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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2015-02-20 16:15 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-02-20 15:11 pgsql: Have TRUNCATE update pgstat tuple counters Alvaro Herrera <alvherre@alvh.no-ip.org>
2015-02-20 15:23 ` Tom Lane <tgl@sss.pgh.pa.us>
2015-02-20 16:08   ` Alvaro Herrera <alvherre@2ndquadrant.com>
2015-02-20 16:15     ` Tom Lane <tgl@sss.pgh.pa.us>

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