pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: Seino Yuki <seinoyu@oss.nttdata.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Add statistics refresh materialized view
Date: Wed, 1 Sep 2021 23:15:52 +0900
Message-ID: <2262038c-7465-e588-5bcf-1df66d5eef45@oss.nttdata.com> (raw)
In-Reply-To: <6fe02a8ab3b2b0801933b9cabfab62cf@oss.nttdata.com>
References: <6fe02a8ab3b2b0801933b9cabfab62cf@oss.nttdata.com>



On 2021/07/09 1:39, Seino Yuki wrote:
> Hi.
> 
> This is a proposal for a new feature in statistics collector.
> I think we need to add statistics about refresh matview to pg_stat_all_tables view.

Why do you want to treat only REFRESH MATERIALIZED VIEW command special?
What about other utility commands like TRUNCATE, CLUSTER, etc?

It's not good design to add new columns per utility command into
pg_stat_all_tables. Otherwise pg_stat_all_tables will have to have lots of
columns to expose the stats of many utility commands at last. Which is
ugly and very user-unfriendly.

Most entries in pg_stat_all_tables are basically for tables. So the columns
about REFRESH MATERIALIZED VIEW are useless for those most entries.
This is another reason why I think the design is not good.


> 
> When the "REFRESH MATERIALIZED VIEW" was executed, the number of times it was executed
> and date it took were not recorded anywhere.

pg_stat_statements and log_statement would help?


> 
> "pg_stat_statements" can be used to get the number of executions and the date and time of execution,
> but this information is statement-based, not view-based.

pg_stat_statements reports different records for REFRESH MATERIALIZED VIEW
commands on different views. So ISTM that we can aggregate the information
per view, from pg_stat_statements. No?

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION





view thread (9+ messages)  latest in thread

Message-ID: <2262038c-7465-e588-5bcf-1df66d5eef45@oss.nttdata.com>
Permalink:  ../2262038c-7465-e588-5bcf-1df66d5eef45@oss.nttdata.com/
Also on:    postgresql.org/message-id/2262038c-7465-e588-5bcf-1df66d5eef45@oss.nttdata.com

 · 

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-hackers@postgresql.org
  Cc: masao.fujii@oss.nttdata.com, seinoyu@oss.nttdata.com
  Subject: Re: Add statistics refresh materialized view
  In-Reply-To: <2262038c-7465-e588-5bcf-1df66d5eef45@oss.nttdata.com>
  References: <6fe02a8ab3b2b0801933b9cabfab62cf@oss.nttdata.com> <2262038c-7465-e588-5bcf-1df66d5eef45@oss.nttdata.com>

* 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