From 17f8ffa1e331cd0d95a3c4ccec66ea83d8b893c5 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 18 Mar 2017 17:49:06 -0400 Subject: 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 --- src/backend/postmaster/pgstat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/backend/postmaster') diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c index 5fe9f35199a..3a50488db32 100644 --- a/src/backend/postmaster/pgstat.c +++ b/src/backend/postmaster/pgstat.c @@ -1803,7 +1803,7 @@ add_tabstat_xact_level(PgStat_TableStatus *pgstat_info, int nest_level) * pgstat_count_heap_insert - count a tuple insertion of n tuples */ void -pgstat_count_heap_insert(Relation rel, int n) +pgstat_count_heap_insert(Relation rel, PgStat_Counter n) { PgStat_TableStatus *pgstat_info = rel->pgstat_info; -- cgit v1.2.3