Re: REFRESH MATERIALIZED VIEW and completion tag output

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: REFRESH MATERIALIZED VIEW and completion tag output
Date: 2020-11-06 00:45:07
Message-ID: 0a80d075-e75b-5aec-1d29-76391cafe890@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2020/11/06 1:56, Mark Dilger wrote:
>
>
>> On Nov 5, 2020, at 8:20 AM, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> wrote:
>>
>> The patch that makes pg_stat_statements track the number of rows that
>> REFRESH MATERIALIZED VIEW command processes was proposed at [1].
>> When reviewing the patch, I just wondered why the completion tag output
>> for REFRESH MATERIALIZED VIEW doesn't include the row count. Is this
>> an intentional behavior? I've not found the past discussion about this yet.
>
> Of 191 command tags, only 7 return the number of rows. See src/include/tcop/cmdtaglist.h. REFRESH MATERIALIZED VIEW is similar to CREATE MATERIALIZED VIEW and also CREATE TABLE AS, which also do not return the row count.

Yes, so I was wondering if REFRESH MATERIALIZED VIEW also should use
CMDTAG_SELECT like CREATE MATERIALIZED VIEW does.

> I think this behavior is historical, and preserved for compatibility.

Maybe true. The patch that I mentioned upthread tries to change
REFRESH MATERIALIZED VIEW so that it register the rowcount into
its query completion so that pg_stat_statements can track
the number of processed rows. But display_rowcount for
CMDTAG_REFRESH_MATERIALIZED_VIEW still should be false
in cmdtaglist.h to avoid the change of the completion tag output.

Regards,

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiro Ikeda 2020-11-06 01:25:07 Re: Add statistics to pg_stat_wal view for wal related parameter tuning
Previous Message David G. Johnston 2020-11-06 00:38:46 Re: Why does to_json take "anyelement" rather than "any"?