pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Fix REFRESH MATERIALIZED VIEW to report activity to the stats co
Date: Sat, 18 Mar 2017 21:49:48 +0000
Message-ID: <E1cpMEO-0004Lr-Us@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Fix REFRESH MATERIALIZED VIEW to report activity to the stats collector.

The non-concurrent code path for REFRESH MATERIALIZED VIEW failed to
report its updates to the stats collector.  This is bad since it means
auto-analyze doesn't know there's any work to be done.  Adjust it to
report the refresh as a table truncate followed by insertion of an
appropriate number of rows.

Since a matview could contain more than INT_MAX rows, change the
signature of pgstat_count_heap_insert() to accept an int64 rowcount.
(The accumulator it's adding into is already int64, but existing
callers could not insert more than a small number of rows at once,
so the argument had been declared just "int n".)

This is surely a bug fix, but changing pgstat_count_heap_insert()'s API
seems too risky for the back branches.  Given the lack of previous
complaints, I'm not sure it's a big enough problem to justify a kluge
solution that would avoid that.  So, no back-patch, at least for now.

Jim Mlodgenski, adjusted a bit by me

Discussion: https://postgr.es/m/CAB_5SRchSz7-WmdO5szdiknG8Oj_GGqJytrk1KRd11yhcMs1KQ@mail.gmail.com

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/17f8ffa1e331cd0d95a3c4ccec66ea83d8b893c5

Modified Files
--------------
src/backend/commands/matview.c  | 30 +++++++++++++++++++++++++++---
src/backend/postmaster/pgstat.c |  2 +-
src/include/pgstat.h            |  2 +-
3 files changed, 29 insertions(+), 5 deletions(-)


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


Message-ID: <E1cpMEO-0004Lr-Us@gemulon.postgresql.org>
Permalink:  ../E1cpMEO-0004Lr-Us@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1cpMEO-0004Lr-Us@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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix REFRESH MATERIALIZED VIEW to report activity to the stats co
  In-Reply-To: <E1cpMEO-0004Lr-Us@gemulon.postgresql.org>
  References: <E1cpMEO-0004Lr-Us@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