pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Add statistics refresh materialized view
9+ messages / 6 participants
[nested] [flat]

* Add statistics refresh materialized view
@ 2021-07-08 16:39  Seino Yuki <seinoyu@oss.nttdata.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Seino Yuki @ 2021-07-08 16:39 UTC (permalink / raw)
  To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

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.

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" 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.
Also, that method requires the high cost of "pg_stat_statements".

This patch will add statistics(count, last time) about "REFRESH 
MATERIALIZED VIEW"
to pg_stat_all_tables(pg_stat_user_tables, [pg_stat_sys_tables]).

What do you think?

Regards,
Seino Yuki

Attachments:

add_statistics_refresh_matview_v1.patch (text/x-diff, 11.4K) download diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index 643e1ad49f..884585af0c 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -4285,6 +4285,26 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i daemon </para></entry> </row> + + <row> + <entry role="catalog_table_entry"><para role="column_definition"> + <structfield>last_refresh_matview_time</structfield> <type>timestamp with time zone</type> + </para> + <para> + Last time at which this materialized view was refreshed + (If this record is materialized view) + </para></entry> + </row> + + <row> + <entry role="catalog_table_entry"><para role="column_definition"> + <structfield>refresh_matview_count</structfield> <type>bigint</type> + </para> + <para> + Number of times this materialized view has been refreshed + (If this record is materialized view) + </para></entry> + </row> </tbody> </tgroup> </table> diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql index 999d984068..70375c7e19 100644 --- a/src/backend/catalog/system_views.sql +++ b/src/backend/catalog/system_views.sql @@ -656,7 +656,9 @@ CREATE VIEW pg_stat_all_tables AS pg_stat_get_vacuum_count(C.oid) AS vacuum_count, pg_stat_get_autovacuum_count(C.oid) AS autovacuum_count, pg_stat_get_analyze_count(C.oid) AS analyze_count, - pg_stat_get_autoanalyze_count(C.oid) AS autoanalyze_count + pg_stat_get_autoanalyze_count(C.oid) AS autoanalyze_count, + pg_stat_get_last_refresh_matview_time(C.oid) AS last_refresh_matview_time, + pg_stat_get_refresh_matview_count(C.oid) AS refresh_matview_count FROM pg_class C LEFT JOIN pg_index I ON C.oid = I.indrelid LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c index 25bbd8a5c1..20733b04de 100644 --- a/src/backend/commands/matview.c +++ b/src/backend/commands/matview.c @@ -356,6 +356,9 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString, ObjectAddressSet(address, RelationRelationId, matviewOid); + /* Report results to the stats collector */ + pgstat_report_refresh_matview(matviewOid); + /* * Save the rowcount so that pg_stat_statements can track the total number * of rows processed by REFRESH MATERIALIZED VIEW command. Note that we diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c index 11702f2a80..6a378831a9 100644 --- a/src/backend/postmaster/pgstat.c +++ b/src/backend/postmaster/pgstat.c @@ -358,6 +358,7 @@ static void pgstat_recv_checksum_failure(PgStat_MsgChecksumFailure *msg, int len static void pgstat_recv_connstat(PgStat_MsgConn *msg, int len); static void pgstat_recv_replslot(PgStat_MsgReplSlot *msg, int len); static void pgstat_recv_tempfile(PgStat_MsgTempFile *msg, int len); +static void pgstat_recv_refresh_matview(PgStat_MsgRefreshMatview *msg, int len); /* ------------------------------------------------------------ * Public functions called from postmaster follow @@ -1863,6 +1864,28 @@ pgstat_report_replslot_drop(const char *slotname) pgstat_send(&msg, sizeof(PgStat_MsgReplSlot)); } +/* --------- + * pgstat_report_refresh_matview() - + * + * Tell the collector about the matview we just refreshed. + * --------- + */ +void +pgstat_report_refresh_matview(Oid tableoid) +{ + PgStat_MsgRefreshMatview msg; + + if (pgStatSock == PGINVALID_SOCKET || !pgstat_track_counts) + return; + + pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_REFRESHEDMATVIEW); + msg.m_databaseid = MyDatabaseId; + msg.m_tableoid = tableoid; + msg.refreshmatview_time = GetCurrentTimestamp(); + pgstat_send(&msg, sizeof(msg)); +} + + /* ---------- * pgstat_ping() - * @@ -3424,6 +3447,10 @@ PgstatCollectorMain(int argc, char *argv[]) pgstat_recv_connstat(&msg.msg_conn, len); break; + case PGSTAT_MTYPE_REFRESHEDMATVIEW: + pgstat_recv_refresh_matview(&msg.msg_refreshmatview, len); + break; + default: break; } @@ -3600,6 +3627,8 @@ pgstat_get_tab_entry(PgStat_StatDBEntry *dbentry, Oid tableoid, bool create) result->analyze_count = 0; result->autovac_analyze_timestamp = 0; result->autovac_analyze_count = 0; + result->matview_refresh_timestamp = 0; + result->matview_refresh_count = 0; } return result; @@ -4883,6 +4912,8 @@ pgstat_recv_tabstat(PgStat_MsgTabstat *msg, int len) tabentry->analyze_count = 0; tabentry->autovac_analyze_timestamp = 0; tabentry->autovac_analyze_count = 0; + tabentry->matview_refresh_timestamp = 0; + tabentry->matview_refresh_count = 0; } else { @@ -5650,6 +5681,28 @@ pgstat_recv_funcpurge(PgStat_MsgFuncpurge *msg, int len) } } +/* ---------- + * pgstat_recv_refresh_matview() - + * + * Process a REFRESH MATERIALIZED VIEW message. + * ---------- + */ +static void +pgstat_recv_refresh_matview(PgStat_MsgRefreshMatview *msg, int len) +{ + PgStat_StatDBEntry *dbentry; + PgStat_StatTabEntry *tabentry; + + /* + * Store the data in the table's hashtable entry. + */ + dbentry = pgstat_get_db_entry(msg->m_databaseid, true); + tabentry = pgstat_get_tab_entry(dbentry, msg->m_tableoid, true); + tabentry->matview_refresh_timestamp = msg->refreshmatview_time; + tabentry->matview_refresh_count++; +} + + /* ---------- * pgstat_write_statsfile_needed() - * diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c index f0e09eae4d..cfd7f6715c 100644 --- a/src/backend/utils/adt/pgstatfuncs.c +++ b/src/backend/utils/adt/pgstatfuncs.c @@ -378,6 +378,39 @@ pg_stat_get_autoanalyze_count(PG_FUNCTION_ARGS) PG_RETURN_INT64(result); } +Datum +pg_stat_get_last_refresh_matview_time(PG_FUNCTION_ARGS) +{ + Oid relid = PG_GETARG_OID(0); + TimestampTz result; + PgStat_StatTabEntry *tabentry; + + if ((tabentry = pgstat_fetch_stat_tabentry(relid)) == NULL) + result = 0; + else + result = tabentry->matview_refresh_timestamp; + + if (result == 0) + PG_RETURN_NULL(); + else + PG_RETURN_TIMESTAMPTZ(result); +} + +Datum +pg_stat_get_refresh_matview_count(PG_FUNCTION_ARGS) +{ + Oid relid = PG_GETARG_OID(0); + int64 result; + PgStat_StatTabEntry *tabentry; + + if ((tabentry = pgstat_fetch_stat_tabentry(relid)) == NULL) + result = 0; + else + result = (int64) (tabentry->matview_refresh_count); + + PG_RETURN_INT64(result); +} + Datum pg_stat_get_function_calls(PG_FUNCTION_ARGS) { diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat index fde251fa4f..bdf89a3f52 100644 --- a/src/include/catalog/pg_proc.dat +++ b/src/include/catalog/pg_proc.dat @@ -5271,6 +5271,14 @@ proname => 'pg_stat_get_autoanalyze_count', provolatile => 's', proparallel => 'r', prorettype => 'int8', proargtypes => 'oid', prosrc => 'pg_stat_get_autoanalyze_count' }, +{ oid => '6205', descr => 'statistics: number of manual vacuums for a table', + proname => 'pg_stat_get_last_refresh_matview_time', provolatile => 's', proparallel => 'r', + prorettype => 'timestamptz', proargtypes => 'oid', + prosrc => 'pg_stat_get_last_refresh_matview_time' }, +{ oid => '6206', descr => 'statistics: number of manual vacuums for a table', + proname => 'pg_stat_get_refresh_matview_count', provolatile => 's', proparallel => 'r', + prorettype => 'int8', proargtypes => 'oid', + prosrc => 'pg_stat_get_refresh_matview_count' }, { oid => '1936', descr => 'statistics: currently active backend IDs', proname => 'pg_stat_get_backend_idset', prorows => '100', proretset => 't', provolatile => 's', proparallel => 'r', prorettype => 'int4', diff --git a/src/include/pgstat.h b/src/include/pgstat.h index 9612c0a6c2..1c3abce875 100644 --- a/src/include/pgstat.h +++ b/src/include/pgstat.h @@ -82,6 +82,7 @@ typedef enum StatMsgType PGSTAT_MTYPE_CHECKSUMFAILURE, PGSTAT_MTYPE_REPLSLOT, PGSTAT_MTYPE_CONNECTION, + PGSTAT_MTYPE_REFRESHEDMATVIEW } StatMsgType; /* ---------- @@ -676,6 +677,18 @@ typedef struct PgStat_MsgConn SessionEndType m_disconnect; } PgStat_MsgConn; +/* ---------- + * PgStat_MsgRefreshMatview Sent by the backend to update statistics. + after REFRESH MATERIALIZED VIEW. + * ---------- + */ +typedef struct PgStat_MsgRefreshMatview +{ + PgStat_MsgHdr m_hdr; + Oid m_databaseid; + Oid m_tableoid; + TimestampTz refreshmatview_time; +} PgStat_MsgRefreshMatview; /* ---------- * PgStat_Msg Union over all possible messages. @@ -710,6 +723,7 @@ typedef union PgStat_Msg PgStat_MsgChecksumFailure msg_checksumfailure; PgStat_MsgReplSlot msg_replslot; PgStat_MsgConn msg_conn; + PgStat_MsgRefreshMatview msg_refreshmatview; } PgStat_Msg; @@ -807,6 +821,9 @@ typedef struct PgStat_StatTabEntry PgStat_Counter analyze_count; TimestampTz autovac_analyze_timestamp; /* autovacuum initiated */ PgStat_Counter autovac_analyze_count; + + TimestampTz matview_refresh_timestamp; /* refresh matview executed */ + PgStat_Counter matview_refresh_count; } PgStat_StatTabEntry; @@ -1011,7 +1028,7 @@ extern void pgstat_report_checksum_failure(void); extern void pgstat_report_replslot(const PgStat_StatReplSlotEntry *repSlotStat); extern void pgstat_report_replslot_create(const char *slotname); extern void pgstat_report_replslot_drop(const char *slotname); - +extern void pgstat_report_refresh_matview(Oid tableoid); extern void pgstat_initialize(void); diff --git a/src/test/regress/expected/rules.out b/src/test/regress/expected/rules.out index e5ab11275d..9471afb267 100644 --- a/src/test/regress/expected/rules.out +++ b/src/test/regress/expected/rules.out @@ -1803,7 +1803,9 @@ pg_stat_all_tables| SELECT c.oid AS relid, pg_stat_get_vacuum_count(c.oid) AS vacuum_count, pg_stat_get_autovacuum_count(c.oid) AS autovacuum_count, pg_stat_get_analyze_count(c.oid) AS analyze_count, - pg_stat_get_autoanalyze_count(c.oid) AS autoanalyze_count + pg_stat_get_autoanalyze_count(c.oid) AS autoanalyze_count, + pg_stat_get_last_refresh_matview_time(c.oid) AS last_refresh_matview_time, + pg_stat_get_refresh_matview_count(c.oid) AS refresh_matview_count FROM ((pg_class c LEFT JOIN pg_index i ON ((c.oid = i.indrelid))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) @@ -2126,7 +2128,9 @@ pg_stat_sys_tables| SELECT pg_stat_all_tables.relid, pg_stat_all_tables.vacuum_count, pg_stat_all_tables.autovacuum_count, pg_stat_all_tables.analyze_count, - pg_stat_all_tables.autoanalyze_count + pg_stat_all_tables.autoanalyze_count, + pg_stat_all_tables.last_refresh_matview_time, + pg_stat_all_tables.refresh_matview_count FROM pg_stat_all_tables WHERE ((pg_stat_all_tables.schemaname = ANY (ARRAY['pg_catalog'::name, 'information_schema'::name])) OR (pg_stat_all_tables.schemaname ~ '^pg_toast'::text)); pg_stat_user_functions| SELECT p.oid AS funcid, @@ -2170,7 +2174,9 @@ pg_stat_user_tables| SELECT pg_stat_all_tables.relid, pg_stat_all_tables.vacuum_count, pg_stat_all_tables.autovacuum_count, pg_stat_all_tables.analyze_count, - pg_stat_all_tables.autoanalyze_count + pg_stat_all_tables.autoanalyze_count, + pg_stat_all_tables.last_refresh_matview_time, + pg_stat_all_tables.refresh_matview_count FROM pg_stat_all_tables WHERE ((pg_stat_all_tables.schemaname <> ALL (ARRAY['pg_catalog'::name, 'information_schema'::name])) AND (pg_stat_all_tables.schemaname !~ '^pg_toast'::text)); pg_stat_wal| SELECT w.wal_records,
^ permalink raw reply [nested|flat] 9+ messages in thread

* Re: Add statistics refresh materialized view
@ 2021-09-01 14:15  Fujii Masao <masao.fujii@oss.nttdata.com>
  parent: Seino Yuki <seinoyu@oss.nttdata.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Fujii Masao @ 2021-09-01 14:15 UTC (permalink / raw)
  To: Seino Yuki <seinoyu@oss.nttdata.com>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>



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





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

* Re: Add statistics refresh materialized view
@ 2021-09-07 09:11  Seino Yuki <seinoyu@oss.nttdata.com>
  parent: Fujii Masao <masao.fujii@oss.nttdata.com>
  0 siblings, 2 replies; 9+ messages in thread

From: Seino Yuki @ 2021-09-07 09:11 UTC (permalink / raw)
  To: Fujii Masao <masao.fujii@oss.nttdata.com>; +Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

On 2021-09-01 23:15, Fujii Masao wrote:
> Why do you want to treat only REFRESH MATERIALIZED VIEW command 
> special?
> What about other utility commands like TRUNCATE, CLUSTER, etc?

First of all, knowing the update date and time of the MATVIEW is 
essential for actual operation.
Without that information, users will not be able to trust the MATVIEW.

In terms of the reliability of the information in the table,
I think the priority of the REFRESHED MATVIEW is higher than that of 
TRUNCATE and CLUSTER.


> 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.

I agree with this opinion.
Initially, I thought about storing this information in pg_matviews,
but decided against it because of the overhead of adding it to the 
system catalog.


> 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?

I made this suggestion based on the premise that the last update date 
and time of the Mateview should always be retained.
I think the same concept applies to Oracle Database.
https://docs.oracle.com/cd/F19136_01/refrn/ALL_MVIEWS.html#GUID-8B9432B5-6B66-411A-936E-590D9D7671E9
I thought it would be useless to enable pg_stat_statements and 
log_statement to see this information.


However, as you said, for most use cases, pg_stat_statements and 
log_statement may be sufficient.
I would like to withdraw this proposal.

Regards,





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

* Re: Add statistics refresh materialized view
@ 2021-10-01 06:49  Michael Paquier <michael@paquier.xyz>
  parent: Seino Yuki <seinoyu@oss.nttdata.com>
  1 sibling, 0 replies; 9+ messages in thread

From: Michael Paquier @ 2021-10-01 06:49 UTC (permalink / raw)
  To: Seino Yuki <seinoyu@oss.nttdata.com>; +Cc: Fujii Masao <masao.fujii@oss.nttdata.com>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

On Tue, Sep 07, 2021 at 06:11:14PM +0900, Seino Yuki wrote:
> I would like to withdraw this proposal.

This was registered in the CF, so marked as RwF.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

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

* Re: Add statistics refresh materialized view
@ 2024-07-04 15:43  Said Assemlal <sassemlal@neurorx.com>
  parent: Seino Yuki <seinoyu@oss.nttdata.com>
  1 sibling, 1 reply; 9+ messages in thread

From: Said Assemlal @ 2024-07-04 15:43 UTC (permalink / raw)
  To: Seino Yuki <seinoyu@oss.nttdata.com>; Fujii Masao <masao.fujii@oss.nttdata.com>; +Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

Hi,


> However, as you said, for most use cases, pg_stat_statements and 
> log_statement may be sufficient.
> I would like to withdraw this proposal.
>
Well, they either require extensions or parameters to be set properly. 
One advantage I see to store those kind of information is that it can be 
queried by application developers (users are reporting old data for 
example).

We currently have to rely on other ways to figure out if materialized 
views were properly refreshed.










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

* Re: Add statistics refresh materialized view
@ 2026-07-29 08:21  Rafia Sabih <rafia.pghackers@gmail.com>
  parent: Said Assemlal <sassemlal@neurorx.com>
  0 siblings, 2 replies; 9+ messages in thread

From: Rafia Sabih @ 2026-07-29 08:21 UTC (permalink / raw)
  To: Said Assemlal <sassemlal@neurorx.com>; +Cc: Seino Yuki <seinoyu@oss.nttdata.com>; Fujii Masao <masao.fujii@oss.nttdata.com>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

On Thu, 4 Jul 2024 at 21:13, Said Assemlal <sassemlal@neurorx.com> wrote:

> Hi,
>
>
> > However, as you said, for most use cases, pg_stat_statements and
> > log_statement may be sufficient.
> > I would like to withdraw this proposal.
> >
> Well, they either require extensions or parameters to be set properly.
> One advantage I see to store those kind of information is that it can be
> queried by application developers (users are reporting old data for
> example).
>
> We currently have to rely on other ways to figure out if materialized
> views were properly refreshed.
>
>
>
Hi all,

I agree that there is no easy way currently to figure out the last time a
materialized view was refreshed. I want to work on this, but before
implementing anything I'd like to discuss the right approach.

Looking at the code, REFRESH MATERIALIZED VIEW and the populate step of
CREATE MATERIALIZED VIEW both go through RefreshMatViewByOid() in
matview.c, which already updates relispopulated on pg_class transactionally
once the refresh completes. Recording a timestamp would hook in right
there. Unlike VACUUM, though, REFRESH can run inside a transaction block
and get rolled back, so the timestamp needs to be a normal transactional
catalog update, not something written directly into shared stats memory
like last_vacuum_time. That part seems straightforward. The real question
is where this information should live.

One option is a column on pg_class, say last_refresh timestamptz, set the
same way relispopulated is. Less implementation work, but it would stay
null for every non-matview row, and pg_class already carries every table,
index, sequence, etc., so this adds width with no benefit for the rest.

This was actually discussed back in 2021 (Seino Yuki,
https://www.postgresql.org/message-id/flat/6fe02a8ab3b2b0801933b9cabfab62cf@oss.nttdata.com),
proposing count and last-refresh-time columns on pg_stat_all_tables. I
gather, Fujii Masao objected on two grounds: it singles out REFRESH
MATERIALIZED VIEW when other utility commands (TRUNCATE, CLUSTER, etc.)
could make the same claim, and the columns would be dead weight for the
vast majority of pg_stat_all_tables entries, which are regular tables. I
think that objection is right, and it points at a way to avoid it entirely:
don't touch pg_stat_all_tables or pg_class at all.

That's the second option: a dedicated catalog, e.g. pg_matview_meta(mvrelid
oid, mvlastrefresh timestamptz), one tuple per materialized view. More work
- it needs its own catalog OID, a unique index on mvrelid, and exclusion
from pg_dump / reset on upgrade, since this isn't user data - but it leaves
pg_class and pg_stat_all_tables untouched, sidestepping both of Fujii's
objections, and follows the same pattern as pg_partitioned_table or
pg_statistic_ext_data. I'm leaning this way, partly because it leaves room
to later add refresh duration, last error time, or refresh count.

Looking forward to your inputs, particularly:
- whether the dedicated-catalog approach addresses the 2021 concerns, or
there's still a preference for the pg_class route
- naming (pg_matview_meta / mvrelid / mvlastrefresh)
- handling of REFRESH ... WITH NO DATA should it clear the recorded
timestamp or leave the last real refresh time visible

-- 
Regards,
Rafia Sabih
CYBERTEC PostgreSQL International GmbH

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

* Re: Add statistics refresh materialized view
@ 2026-07-29 08:46  Michael Banck <mbanck@gmx.net>
  parent: Rafia Sabih <rafia.pghackers@gmail.com>
  1 sibling, 0 replies; 9+ messages in thread

From: Michael Banck @ 2026-07-29 08:46 UTC (permalink / raw)
  To: Rafia Sabih <rafia.pghackers@gmail.com>; +Cc: Said Assemlal <sassemlal@neurorx.com>; Seino Yuki <seinoyu@oss.nttdata.com>; Fujii Masao <masao.fujii@oss.nttdata.com>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

Hi,

On Wed, Jul 29, 2026 at 10:21:38AM +0200, Rafia Sabih wrote:
> On Thu, 4 Jul 2024 at 21:13, Said Assemlal <sassemlal@neurorx.com> wrote:
> > > However, as you said, for most use cases, pg_stat_statements and
> > > log_statement may be sufficient.  I would like to withdraw this
> > > proposal.
> >
> > Well, they either require extensions or parameters to be set properly.
> > One advantage I see to store those kind of information is that it can be
> > queried by application developers (users are reporting old data for
> > example).
> >
> > We currently have to rely on other ways to figure out if materialized
> > views were properly refreshed.
>
> I agree that there is no easy way currently to figure out the last time a
> materialized view was refreshed. I want to work on this, but before
> implementing anything I'd like to discuss the right approach.

Yeah.

> Looking at the code, REFRESH MATERIALIZED VIEW and the populate step of
> CREATE MATERIALIZED VIEW both go through RefreshMatViewByOid() in
> matview.c, which already updates relispopulated on pg_class transactionally
> once the refresh completes. Recording a timestamp would hook in right
> there. Unlike VACUUM, though, REFRESH can run inside a transaction block
> and get rolled back, so the timestamp needs to be a normal transactional
> catalog update, not something written directly into shared stats memory
> like last_vacuum_time. That part seems straightforward. The real question
> is where this information should live.
>
> One option is a column on pg_class, say last_refresh timestamptz, set the
> same way relispopulated is. Less implementation work, but it would stay
> null for every non-matview row, and pg_class already carries every table,
> index, sequence, etc., so this adds width with no benefit for the rest.
> 
> This was actually discussed back in 2021 (Seino Yuki,
> https://www.postgresql.org/message-id/flat/6fe02a8ab3b2b0801933b9cabfab62cf@oss.nttdata.com),
> proposing count and last-refresh-time columns on pg_stat_all_tables. I
> gather, Fujii Masao objected on two grounds: it singles out REFRESH
> MATERIALIZED VIEW when other utility commands (TRUNCATE, CLUSTER, etc.)
> could make the same claim, and the columns would be dead weight for the
> vast majority of pg_stat_all_tables entries, which are regular tables. I
> think that objection is right, and it points at a way to avoid it entirely:
> don't touch pg_stat_all_tables or pg_class at all.

pg_class does not have any timestamps so far, so putting it there looks
out-of-place to me. While being important information, it is also not
essential information, so another strike against pg_class in my opinion.

Why not circle back to pg_stat_all_tables and discuss two new columns
there: last_rewrite and rewrite_count? Those would have to be maintained
for regular table rewrites during DDL as well, but I think that would be
(relatively) valuable information anyway. One could argue that "rewrite"
is wrong terminology for a matview refresh but I guess most users would
figure it out.

> That's the second option: a dedicated catalog, e.g. pg_matview_meta(mvrelid
> oid, mvlastrefresh timestamptz), one tuple per materialized view.

As this is more-or-less performance data, I would suggest to go with the
usual pg_stat_* naming schema and non-cryptic column names, as well as
denormalization of schemaname/relation name similar to
pg_stat_all_tables.

So something like pg_stat_matviews with oid, schemaname, relname,
last_refresh, refresh_count and what else. Regarding what else, when you
are adding a new system catalog anyway, it might make sense to maintain
the duration of the refresh as well, similar to pg_stat_statements. So
something like total_refresh_times, min_refresh_time, max_refresh_time,
mean_refresh_time, stddev_refresh_time. But as somebody mentioned
upstream, those should be available from pg_stat_statements today if one
enables it.

> More work - it needs its own catalog OID, a unique index on mvrelid,
> and exclusion from pg_dump / reset on upgrade, since this isn't user
> data 

As an aside, why would it need special pg_dump work? I don't think we
ever dump system catalogs, at least for regular dumps.

> pg_class and pg_stat_all_tables untouched, sidestepping both of Fujii's
> objections, and follows the same pattern as pg_partitioned_table or
> pg_statistic_ext_data. I'm leaning this way, partly because it leaves room
> to later add refresh duration, last error time, or refresh count.

Again, those are all stats.
 
> - handling of REFRESH ... WITH NO DATA should it clear the recorded
> timestamp or leave the last real refresh time visible

Good question.

I think the other important question is: if we ever get incremental
materialized views (IVM), would that change anything here and possibly
make that new system catalog redundant? Would that be a problem in that
case?


Michael






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

* Re: Add statistics refresh materialized view
@ 2026-07-30 06:32  Rafia Sabih <rafia.pghackers@gmail.com>
  parent: Rafia Sabih <rafia.pghackers@gmail.com>
  1 sibling, 1 reply; 9+ messages in thread

From: Rafia Sabih @ 2026-07-30 06:32 UTC (permalink / raw)
  To: Michael Banck <mbanck@gmx.net>; +Cc: Said Assemlal <sassemlal@neurorx.com>; Seino Yuki <seinoyu@oss.nttdata.com>; Fujii Masao <masao.fujii@oss.nttdata.com>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

On Wed, 29 Jul 2026 at 14:17, Michael Banck <mbanck@gmx.net> wrote:

> Hi,
>
> On Wed, Jul 29, 2026 at 10:21:38AM +0200, Rafia Sabih wrote:
> > On Thu, 4 Jul 2024 at 21:13, Said Assemlal <sassemlal@neurorx.com>
> wrote:
> > > > However, as you said, for most use cases, pg_stat_statements and
> > > > log_statement may be sufficient.  I would like to withdraw this
> > > > proposal.
> > >
> > > Well, they either require extensions or parameters to be set properly.
> > > One advantage I see to store those kind of information is that it can
> be
> > > queried by application developers (users are reporting old data for
> > > example).
> > >
> > > We currently have to rely on other ways to figure out if materialized
> > > views were properly refreshed.
> >
> > I agree that there is no easy way currently to figure out the last time a
> > materialized view was refreshed. I want to work on this, but before
> > implementing anything I'd like to discuss the right approach.
>
> Yeah.
>
> > Looking at the code, REFRESH MATERIALIZED VIEW and the populate step of
> > CREATE MATERIALIZED VIEW both go through RefreshMatViewByOid() in
> > matview.c, which already updates relispopulated on pg_class
> transactionally
> > once the refresh completes. Recording a timestamp would hook in right
> > there. Unlike VACUUM, though, REFRESH can run inside a transaction block
> > and get rolled back, so the timestamp needs to be a normal transactional
> > catalog update, not something written directly into shared stats memory
> > like last_vacuum_time. That part seems straightforward. The real question
> > is where this information should live.
> >
> > One option is a column on pg_class, say last_refresh timestamptz, set the
> > same way relispopulated is. Less implementation work, but it would stay
> > null for every non-matview row, and pg_class already carries every table,
> > index, sequence, etc., so this adds width with no benefit for the rest.
> >
> > This was actually discussed back in 2021 (Seino Yuki,
> >
> https://www.postgresql.org/message-id/flat/6fe02a8ab3b2b0801933b9cabfab62cf@oss.nttdata.com
> ),
> > proposing count and last-refresh-time columns on pg_stat_all_tables. I
> > gather, Fujii Masao objected on two grounds: it singles out REFRESH
> > MATERIALIZED VIEW when other utility commands (TRUNCATE, CLUSTER, etc.)
> > could make the same claim, and the columns would be dead weight for the
> > vast majority of pg_stat_all_tables entries, which are regular tables. I
> > think that objection is right, and it points at a way to avoid it
> entirely:
> > don't touch pg_stat_all_tables or pg_class at all.
>
> pg_class does not have any timestamps so far, so putting it there looks
> out-of-place to me. While being important information, it is also not
> essential information, so another strike against pg_class in my opinion.
>

Thank you Michael for your input and giving another good reason to not go
this route.

>
> Why not circle back to pg_stat_all_tables and discuss two new columns
> there: last_rewrite and rewrite_count? Those would have to be maintained
> for regular table rewrites during DDL as well, but I think that would be
> (relatively) valuable information anyway. One could argue that "rewrite"
> is wrong terminology for a matview refresh but I guess most users would
> figure it out.
>
I like the idea, so as I understand it would also be populated by other
commands like VACUUM, CLUSTER, ALTER TABLE, so maybe this could be a good
solution in that way. But in regards to materialised view I am unsure how
to handle REFRESH MATERIALISED VIEW CONCURRENTLY, since in that path there
is no real rewrite happening, rather it makes a new heap. Particularly, in
all the other cases we are calling finish_heap_swap so we can get the
timestamp there for our purpose but not for REFRESH with CONCURRENTLY case.

>
> > That's the second option: a dedicated catalog, e.g.
> pg_matview_meta(mvrelid
> > oid, mvlastrefresh timestamptz), one tuple per materialized view.
>
> As this is more-or-less performance data, I would suggest to go with the
> usual pg_stat_* naming schema and non-cryptic column names, as well as
> denormalization of schemaname/relation name similar to
> pg_stat_all_tables.


> So something like pg_stat_matviews with oid, schemaname, relname,
> last_refresh, refresh_count and what else. Regarding what else, when you
> are adding a new system catalog anyway, it might make sense to maintain
> the duration of the refresh as well, similar to pg_stat_statements. So
> something like total_refresh_times, min_refresh_time, max_refresh_time,
> mean_refresh_time, stddev_refresh_time. But as somebody mentioned
> upstream, those should be available from pg_stat_statements today if one
> enables it.
>
> +1

> > More work - it needs its own catalog OID, a unique index on mvrelid,
> > and exclusion from pg_dump / reset on upgrade, since this isn't user
> > data
>
> As an aside, why would it need special pg_dump work? I don't think we
> ever dump system catalogs, at least for regular dumps.
>
> I meant we need to ensure that it is not included in pg_dump, etc. But you
are right there shouldn't be any special handling for this case.

> > pg_class and pg_stat_all_tables untouched, sidestepping both of Fujii's
> > objections, and follows the same pattern as pg_partitioned_table or
> > pg_statistic_ext_data. I'm leaning this way, partly because it leaves
> room
> > to later add refresh duration, last error time, or refresh count.
>
> Again, those are all stats.
>
> > - handling of REFRESH ... WITH NO DATA should it clear the recorded
> > timestamp or leave the last real refresh time visible
>
> Good question.
>
Yes and an interesting one to know the answer to before starting
implementation.

>
> I think the other important question is: if we ever get incremental
> materialized views (IVM), would that change anything here and possibly
> make that new system catalog redundant? Would that be a problem in that
> case?
>
> I thought a little about it based on the extension pg_ivm, but it doesn't
look like anything changes here. The ivm is working based on triggers so it
doesn't conflict with the path which we are covering here. Also, looks like
even when ivm is in core it is likely to have its own catalog table.

Michael
>
>
>

-- 
Regards,
Rafia Sabih
CYBERTEC PostgreSQL International GmbH

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

* Re: Add statistics refresh materialized view
@ 2026-09-09 11:00  Rafia Sabih <rafia.pghackers@gmail.com>
  parent: Rafia Sabih <rafia.pghackers@gmail.com>
  0 siblings, 0 replies; 9+ messages in thread

From: Rafia Sabih @ 2026-09-09 11:00 UTC (permalink / raw)
  To: Michael Banck <mbanck@gmx.net>; +Cc: Said Assemlal <sassemlal@neurorx.com>; Seino Yuki <seinoyu@oss.nttdata.com>; Fujii Masao <masao.fujii@oss.nttdata.com>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

Based on this discussion, I worked on the first version of this patch.
Please find the attached file.
Looking forward to your feedback.

On Thu, 30 Jul 2026 at 08:32, Rafia Sabih <rafia.pghackers@gmail.com> wrote:

>
>
> On Wed, 29 Jul 2026 at 14:17, Michael Banck <mbanck@gmx.net> wrote:
>
>> Hi,
>>
>> On Wed, Jul 29, 2026 at 10:21:38AM +0200, Rafia Sabih wrote:
>> > On Thu, 4 Jul 2024 at 21:13, Said Assemlal <sassemlal@neurorx.com>
>> wrote:
>> > > > However, as you said, for most use cases, pg_stat_statements and
>> > > > log_statement may be sufficient.  I would like to withdraw this
>> > > > proposal.
>> > >
>> > > Well, they either require extensions or parameters to be set properly.
>> > > One advantage I see to store those kind of information is that it can
>> be
>> > > queried by application developers (users are reporting old data for
>> > > example).
>> > >
>> > > We currently have to rely on other ways to figure out if materialized
>> > > views were properly refreshed.
>> >
>> > I agree that there is no easy way currently to figure out the last time
>> a
>> > materialized view was refreshed. I want to work on this, but before
>> > implementing anything I'd like to discuss the right approach.
>>
>> Yeah.
>>
>> > Looking at the code, REFRESH MATERIALIZED VIEW and the populate step of
>> > CREATE MATERIALIZED VIEW both go through RefreshMatViewByOid() in
>> > matview.c, which already updates relispopulated on pg_class
>> transactionally
>> > once the refresh completes. Recording a timestamp would hook in right
>> > there. Unlike VACUUM, though, REFRESH can run inside a transaction block
>> > and get rolled back, so the timestamp needs to be a normal transactional
>> > catalog update, not something written directly into shared stats memory
>> > like last_vacuum_time. That part seems straightforward. The real
>> question
>> > is where this information should live.
>> >
>> > One option is a column on pg_class, say last_refresh timestamptz, set
>> the
>> > same way relispopulated is. Less implementation work, but it would stay
>> > null for every non-matview row, and pg_class already carries every
>> table,
>> > index, sequence, etc., so this adds width with no benefit for the rest.
>> >
>> > This was actually discussed back in 2021 (Seino Yuki,
>> >
>> https://www.postgresql.org/message-id/flat/6fe02a8ab3b2b0801933b9cabfab62cf@oss.nttdata.com
>> ),
>> > proposing count and last-refresh-time columns on pg_stat_all_tables. I
>> > gather, Fujii Masao objected on two grounds: it singles out REFRESH
>> > MATERIALIZED VIEW when other utility commands (TRUNCATE, CLUSTER, etc.)
>> > could make the same claim, and the columns would be dead weight for the
>> > vast majority of pg_stat_all_tables entries, which are regular tables. I
>> > think that objection is right, and it points at a way to avoid it
>> entirely:
>> > don't touch pg_stat_all_tables or pg_class at all.
>>
>> pg_class does not have any timestamps so far, so putting it there looks
>> out-of-place to me. While being important information, it is also not
>> essential information, so another strike against pg_class in my opinion.
>>
>
> Thank you Michael for your input and giving another good reason to not go
> this route.
>
>>
>> Why not circle back to pg_stat_all_tables and discuss two new columns
>> there: last_rewrite and rewrite_count? Those would have to be maintained
>> for regular table rewrites during DDL as well, but I think that would be
>> (relatively) valuable information anyway. One could argue that "rewrite"
>> is wrong terminology for a matview refresh but I guess most users would
>> figure it out.
>>
> I like the idea, so as I understand it would also be populated by other
> commands like VACUUM, CLUSTER, ALTER TABLE, so maybe this could be a good
> solution in that way. But in regards to materialised view I am unsure how
> to handle REFRESH MATERIALISED VIEW CONCURRENTLY, since in that path there
> is no real rewrite happening, rather it makes a new heap. Particularly, in
> all the other cases we are calling finish_heap_swap so we can get the
> timestamp there for our purpose but not for REFRESH with CONCURRENTLY case.
>
>>
>> > That's the second option: a dedicated catalog, e.g.
>> pg_matview_meta(mvrelid
>> > oid, mvlastrefresh timestamptz), one tuple per materialized view.
>>
>> As this is more-or-less performance data, I would suggest to go with the
>> usual pg_stat_* naming schema and non-cryptic column names, as well as
>> denormalization of schemaname/relation name similar to
>> pg_stat_all_tables.
>
>
>> So something like pg_stat_matviews with oid, schemaname, relname,
>> last_refresh, refresh_count and what else. Regarding what else, when you
>> are adding a new system catalog anyway, it might make sense to maintain
>> the duration of the refresh as well, similar to pg_stat_statements. So
>> something like total_refresh_times, min_refresh_time, max_refresh_time,
>> mean_refresh_time, stddev_refresh_time. But as somebody mentioned
>> upstream, those should be available from pg_stat_statements today if one
>> enables it.
>>
>> +1
>
>> > More work - it needs its own catalog OID, a unique index on mvrelid,
>> > and exclusion from pg_dump / reset on upgrade, since this isn't user
>> > data
>>
>> As an aside, why would it need special pg_dump work? I don't think we
>> ever dump system catalogs, at least for regular dumps.
>>
>> I meant we need to ensure that it is not included in pg_dump, etc. But
> you are right there shouldn't be any special handling for this case.
>
>> > pg_class and pg_stat_all_tables untouched, sidestepping both of Fujii's
>> > objections, and follows the same pattern as pg_partitioned_table or
>> > pg_statistic_ext_data. I'm leaning this way, partly because it leaves
>> room
>> > to later add refresh duration, last error time, or refresh count.
>>
>> Again, those are all stats.
>>
>> > - handling of REFRESH ... WITH NO DATA should it clear the recorded
>> > timestamp or leave the last real refresh time visible
>>
>> Good question.
>>
> Yes and an interesting one to know the answer to before starting
> implementation.
>
>>
>> I think the other important question is: if we ever get incremental
>> materialized views (IVM), would that change anything here and possibly
>> make that new system catalog redundant? Would that be a problem in that
>> case?
>>
>> I thought a little about it based on the extension pg_ivm, but it doesn't
> look like anything changes here. The ivm is working based on triggers so it
> doesn't conflict with the path which we are covering here. Also, looks like
> even when ivm is in core it is likely to have its own catalog table.
>
> Michael
>>
>>
>>
>
> --
> Regards,
> Rafia Sabih
> CYBERTEC PostgreSQL International GmbH
>


-- 
Regards,
Rafia Sabih
CYBERTEC PostgreSQL International GmbH

Attachments:

v1-0001-Track-last-refresh-time-and-count-for-materialize.patch (application/octet-stream, 27.6K) download From 4ae20801ff0c8e35b9a586e61a0427895ca485ed Mon Sep 17 00:00:00 2001 From: Rafia Sabih <rafia.sabih@cybertec.at> Date: Wed, 9 Sep 2026 12:58:04 +0200 Subject: [PATCH v1] Track last-refresh time and count for materialized views Add pg_matview_stat, a system catalog for each materialized view that has been populated with real data at least once. The timestamp of its last such refresh and how many times that has happened. It is exposed to users through a new pg_stat_matviews view, which joins it with pg_class/pg_namespace and lists every materialized view (refreshed or not). --- doc/src/sgml/catalogs.sgml | 81 ++++++++++++++++++ doc/src/sgml/monitoring.sgml | 105 ++++++++++++++++++++++++ src/backend/catalog/heap.c | 6 ++ src/backend/catalog/system_views.sql | 11 +++ src/backend/commands/matview.c | 109 +++++++++++++++++++++++++ src/include/catalog/Makefile | 3 +- src/include/catalog/catversion.h | 2 +- src/include/catalog/meson.build | 1 + src/include/catalog/pg_matview_stat.h | 64 +++++++++++++++ src/include/commands/matview.h | 2 + src/test/regress/expected/matview.out | 99 ++++++++++++++++++++++ src/test/regress/expected/oidjoins.out | 1 + src/test/regress/expected/rules.out | 9 ++ src/test/regress/sql/matview.sql | 60 ++++++++++++++ 14 files changed, 551 insertions(+), 2 deletions(-) create mode 100644 src/include/catalog/pg_matview_stat.h diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index 78cce7e370d..d7ea9a894b5 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -200,6 +200,11 @@ <entry>metadata for large objects</entry> </row> + <row> + <entry><link linkend="catalog-pg-matview-stat"><structname>pg_matview_stat</structname></link></entry> + <entry>materialized view refresh statistics</entry> + </row> + <row> <entry><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link></entry> <entry>schemas</entry> @@ -5117,6 +5122,82 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l </sect1> + <sect1 id="catalog-pg-matview-stat"> + <title><structname>pg_matview_stat</structname></title> + + <indexterm zone="catalog-pg-matview-stat"> + <primary>pg_matview_stat</primary> + </indexterm> + + <para> + The catalog <structname>pg_matview_stat</structname> stores, for each + materialized view that has been populated with real data at least once, + the time of its last such refresh and how many times it has happened. + There is one row per materialized view that has ever been refreshed with + data; a materialized view that was only ever created or refreshed with + <literal>WITH NO DATA</literal> has no row here. + </para> + + <para> + This catalog is normally examined through the more convenient view + <link linkend="monitoring-pg-stat-matviews-view"><structname>pg_stat_matviews</structname></link>, + which joins it with <structname>pg_class</structname> and + <structname>pg_namespace</structname> and lists every materialized + view, refreshed or not. + </para> + + <table> + <title><structname>pg_matview_stat</structname> Columns</title> + <tgroup cols="1"> + <thead> + <row> + <entry role="catalog_table_entry"><para role="column_definition"> + Column Type + </para> + <para> + Description + </para></entry> + </row> + </thead> + + <tbody> + <row> + <entry role="catalog_table_entry"><para role="column_definition"> + <structfield>mvrelid</structfield> <type>oid</type> + (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>) + </para> + <para> + Reference to the materialized view + </para></entry> + </row> + + <row> + <entry role="catalog_table_entry"><para role="column_definition"> + <structfield>mvrefreshcount</structfield> <type>int8</type> + </para> + <para> + Number of times the materialized view has been refreshed with real + data (that is, without <literal>WITH NO DATA</literal>) + </para></entry> + </row> + + <row> + <entry role="catalog_table_entry"><para role="column_definition"> + <structfield>mvlastrefresh</structfield> <type>timestamptz</type> + </para> + <para> + Time of the most recent refresh that populated the materialized view + with real data. A subsequent <command>REFRESH MATERIALIZED VIEW + ... WITH NO DATA</command> does not change this column, so it keeps + showing the last time the view actually held valid data. + </para></entry> + </row> + </tbody> + </tgroup> + </table> + </sect1> + + <sect1 id="catalog-pg-namespace"> <title><structname>pg_namespace</structname></title> diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index b403fb990a7..9868bd55d74 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -616,6 +616,17 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser user tables are shown.</entry> </row> + <row> + <entry><structname>pg_stat_matviews</structname><indexterm><primary>pg_stat_matviews</primary></indexterm></entry> + <entry> + One row for each materialized view in the current database, showing + the last time it was refreshed with real data and how many times + that has happened. See + <link linkend="monitoring-pg-stat-matviews-view"> + <structname>pg_stat_matviews</structname></link> for details. + </entry> + </row> + <row> <entry><structname>pg_stat_autovacuum_scores</structname><indexterm><primary>pg_stat_autovacuum_scores</primary></indexterm></entry> <entry> @@ -4804,6 +4815,100 @@ description | Waiting for a newly initialized WAL file to reach durable storage </sect2> + <sect2 id="monitoring-pg-stat-matviews-view"> + <title><structname>pg_stat_matviews</structname></title> + + <indexterm zone="monitoring-pg-stat-matviews-view"> + <primary>pg_stat_matviews</primary> + </indexterm> + + <para> + The <structname>pg_stat_matviews</structname> view will contain one row + for each materialized view in the current database, showing the last + time it was refreshed with real data and how many times that has + happened. Unlike most <structname>pg_stat_*</structname> views, this + information is not collected by the cumulative statistics subsystem: it + is tracked in the regular system catalog + <link linkend="catalog-pg-matview-stat"><structname>pg_matview_stat</structname></link>, + so that it participates correctly in transactions -- if a + <command>REFRESH MATERIALIZED VIEW</command> is rolled back, the refresh + it would have recorded here is rolled back too. A materialized view + that has never been refreshed with real data (that is, it was only ever + created or refreshed <literal>WITH NO DATA</literal>) still appears in + this view, with null <structfield>last_refresh</structfield> and a + <structfield>refresh_count</structfield> of zero. + </para> + + <table id="pg-stat-matviews-view" xreflabel="pg_stat_matviews"> + <title><structname>pg_stat_matviews</structname> View</title> + <tgroup cols="1"> + <thead> + <row> + <entry role="catalog_table_entry"><para role="column_definition"> + Column Type + </para> + <para> + Description + </para></entry> + </row> + </thead> + + <tbody> + <row> + <entry role="catalog_table_entry"><para role="column_definition"> + <structfield>relid</structfield> <type>oid</type> + (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>) + </para> + <para> + OID of the materialized view + </para></entry> + </row> + + <row> + <entry role="catalog_table_entry"><para role="column_definition"> + <structfield>schemaname</structfield> <type>name</type> + </para> + <para> + Name of the schema that the materialized view is in + </para></entry> + </row> + + <row> + <entry role="catalog_table_entry"><para role="column_definition"> + <structfield>matviewname</structfield> <type>name</type> + </para> + <para> + Name of the materialized view + </para></entry> + </row> + + <row> + <entry role="catalog_table_entry"><para role="column_definition"> + <structfield>last_refresh</structfield> <type>timestamp with time zone</type> + </para> + <para> + Time of the most recent refresh that populated the materialized view + with real data, or null if it has never been so refreshed. A + <command>REFRESH MATERIALIZED VIEW ... WITH NO DATA</command> does + not update this. + </para></entry> + </row> + + <row> + <entry role="catalog_table_entry"><para role="column_definition"> + <structfield>refresh_count</structfield> <type>bigint</type> + </para> + <para> + Number of times the materialized view has been refreshed with real + data + </para></entry> + </row> + </tbody> + </tgroup> + </table> + + </sect2> + <sect2 id="monitoring-pg-stat-autovacuum-scores-view"> <title><structname>pg_stat_autovacuum_scores</structname></title> diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index a107193d7ab..eed1f14bbb2 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -54,6 +54,7 @@ #include "catalog/pg_tablespace.h" #include "catalog/pg_type.h" #include "catalog/storage.h" +#include "commands/matview.h" #include "commands/tablecmds.h" #include "commands/typecmds.h" #include "common/int.h" @@ -1938,6 +1939,11 @@ heap_drop_with_catalog(Oid relid) */ RemoveStatistics(relid, 0); + /* + * delete any recorded materialized view refresh statistics + */ + MatViewStatRemove(relid); + /* * delete attribute tuples */ diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql index 8612d99a890..ccbd569aa3a 100644 --- a/src/backend/catalog/system_views.sql +++ b/src/backend/catalog/system_views.sql @@ -156,6 +156,17 @@ CREATE VIEW pg_matviews AS LEFT JOIN pg_tablespace T ON (T.oid = C.reltablespace) WHERE C.relkind = 'm'; +CREATE VIEW pg_stat_matviews AS + SELECT + C.oid AS relid, + N.nspname AS schemaname, + C.relname AS matviewname, + S.mvlastrefresh AS last_refresh, + COALESCE(S.mvrefreshcount, 0::bigint) AS refresh_count + FROM pg_class C LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) + LEFT JOIN pg_matview_stat S ON (S.mvrelid = C.oid) + WHERE C.relkind = 'm'; + CREATE VIEW pg_indexes AS SELECT N.nspname AS schemaname, diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c index 40748958eaf..ccd3586c22d 100644 --- a/src/backend/commands/matview.c +++ b/src/backend/commands/matview.c @@ -23,6 +23,7 @@ #include "catalog/indexing.h" #include "catalog/namespace.h" #include "catalog/pg_am.h" +#include "catalog/pg_matview_stat.h" #include "catalog/pg_opclass.h" #include "commands/matview.h" #include "commands/repack.h" @@ -36,10 +37,12 @@ #include "storage/lmgr.h" #include "tcop/tcopprot.h" #include "utils/builtins.h" +#include "utils/fmgroids.h" #include "utils/lsyscache.h" #include "utils/rel.h" #include "utils/snapmgr.h" #include "utils/syscache.h" +#include "utils/timestamp.h" typedef struct @@ -67,6 +70,7 @@ static void refresh_by_heap_swap(Oid matviewOid, Oid OIDNewHeap, char relpersist static bool is_usable_unique_index(Relation indexRel); static void OpenMatViewIncrementalMaintenance(void); static void CloseMatViewIncrementalMaintenance(void); +static void MatViewStatRecordRefresh(Oid matviewOid); /* * SetMatViewPopulatedState @@ -108,6 +112,107 @@ SetMatViewPopulatedState(Relation relation, bool newstate) CommandCounterIncrement(); } +/* + * MatViewStatRecordRefresh + * Record, in pg_matview_stat, that matviewOid has just been refreshed + * with real data: bump its refresh count and set its last-refresh + * timestamp to now. + * + * Called only for refreshes that actually populate the view (i.e. not for + * REFRESH ... WITH NO DATA). There is no pre-existing row for a + * materialized view until its first such refresh, so this upserts: it + * updates the row if one exists, or inserts a new one (with a refresh + * count of 1) otherwise. + */ +static void +MatViewStatRecordRefresh(Oid matviewOid) +{ + Relation rel; + HeapTuple oldtup; + HeapTuple newtup; + TimestampTz now = GetCurrentTimestamp(); + + rel = table_open(MatViewStatRelationId, RowExclusiveLock); + + oldtup = SearchSysCacheCopy1(MATVIEWSTATRELID, ObjectIdGetDatum(matviewOid)); + if (HeapTupleIsValid(oldtup)) + { + bool nulls[Natts_pg_matview_stat]; + Datum values[Natts_pg_matview_stat]; + bool replaces[Natts_pg_matview_stat]; + Form_pg_matview_stat oldform = (Form_pg_matview_stat) GETSTRUCT(oldtup); + + memset(values, 0, sizeof(values)); + memset(nulls, false, sizeof(nulls)); + memset(replaces, false, sizeof(replaces)); + + replaces[Anum_pg_matview_stat_mvrefreshcount - 1] = true; + values[Anum_pg_matview_stat_mvrefreshcount - 1] = + Int64GetDatum(oldform->mvrefreshcount + 1); + + replaces[Anum_pg_matview_stat_mvlastrefresh - 1] = true; + values[Anum_pg_matview_stat_mvlastrefresh - 1] = TimestampTzGetDatum(now); + + newtup = heap_modify_tuple(oldtup, RelationGetDescr(rel), + values, nulls, replaces); + CatalogTupleUpdate(rel, &newtup->t_self, newtup); + + heap_freetuple(oldtup); + } + else + { + bool nulls[Natts_pg_matview_stat]; + Datum values[Natts_pg_matview_stat]; + + memset(values, 0, sizeof(values)); + memset(nulls, false, sizeof(nulls)); + + values[Anum_pg_matview_stat_mvrelid - 1] = ObjectIdGetDatum(matviewOid); + values[Anum_pg_matview_stat_mvrefreshcount - 1] = Int64GetDatum(1); + values[Anum_pg_matview_stat_mvlastrefresh - 1] = TimestampTzGetDatum(now); + + newtup = heap_form_tuple(RelationGetDescr(rel), values, nulls); + CatalogTupleInsert(rel, newtup); + } + + heap_freetuple(newtup); + table_close(rel, RowExclusiveLock); +} + +/* + * MatViewStatRemove + * Drop the pg_matview_stat row for relid, if any. + * + * Called from heap_drop_with_catalog() for every dropped relation, + * mirroring how RemoveStatistics() is called there; relations other than + * materialized views simply never have a matching row. + */ +void +MatViewStatRemove(Oid relid) +{ + Relation rel; + SysScanDesc scan; + ScanKeyData key; + HeapTuple tup; + + rel = table_open(MatViewStatRelationId, RowExclusiveLock); + + ScanKeyInit(&key, + Anum_pg_matview_stat_mvrelid, + BTEqualStrategyNumber, F_OIDEQ, + ObjectIdGetDatum(relid)); + + scan = systable_beginscan(rel, MatViewStatRelidIndexId, true, + NULL, 1, &key); + + while (HeapTupleIsValid(tup = systable_getnext(scan))) + CatalogTupleDelete(rel, &tup->t_self); + + systable_endscan(scan); + + table_close(rel, RowExclusiveLock); +} + /* * ExecRefreshMatView -- execute a REFRESH MATERIALIZED VIEW command * @@ -364,6 +469,10 @@ RefreshMatViewByOid(Oid matviewOid, bool is_create, bool skipData, pgstat_count_heap_insert(matviewRel, processed); } + /* Update pg_stat_matviews to record the refresh. */ + if (!skipData) + MatViewStatRecordRefresh(matviewOid); + table_close(matviewRel, NoLock); /* Roll back any GUC changes */ diff --git a/src/include/catalog/Makefile b/src/include/catalog/Makefile index 444fc76eed6..86e0db7c1c0 100644 --- a/src/include/catalog/Makefile +++ b/src/include/catalog/Makefile @@ -81,7 +81,8 @@ CATALOG_HEADERS := \ pg_publication_namespace.h \ pg_publication_rel.h \ pg_subscription.h \ - pg_subscription_rel.h + pg_subscription_rel.h \ + pg_matview_stat.h GENERATED_HEADERS := $(CATALOG_HEADERS:%.h=%_d.h) diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 0be73a52dce..4ec1f3cf4e3 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -57,6 +57,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 202609072 +#define CATALOG_VERSION_NO 202609091 #endif diff --git a/src/include/catalog/meson.build b/src/include/catalog/meson.build index bcc01c87c2e..a7ec397c2b7 100644 --- a/src/include/catalog/meson.build +++ b/src/include/catalog/meson.build @@ -69,6 +69,7 @@ catalog_headers = [ 'pg_publication_rel.h', 'pg_subscription.h', 'pg_subscription_rel.h', + 'pg_matview_stat.h', ] # The .dat files we need can just be listed alphabetically. diff --git a/src/include/catalog/pg_matview_stat.h b/src/include/catalog/pg_matview_stat.h new file mode 100644 index 00000000000..6acb6dbbcea --- /dev/null +++ b/src/include/catalog/pg_matview_stat.h @@ -0,0 +1,64 @@ +/*------------------------------------------------------------------------- + * + * pg_matview_stat.h + * definition of the "materialized view refresh statistics" system + * catalog (pg_matview_stat) + * + * pg_matview_stat records, per materialized view, when it was last + * populated with real data and how many times that has happened. + * + * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * src/include/catalog/pg_matview_stat.h + * + * NOTES + * The Catalog.pm module reads this file and derives schema + * information. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_MATVIEW_STAT_H +#define PG_MATVIEW_STAT_H + +#include "catalog/genbki.h" +#include "catalog/pg_matview_stat_d.h" + +/* ---------------- + * pg_matview_stat definition. cpp turns this into + * typedef struct FormData_pg_matview_stat + * ---------------- + */ +BEGIN_CATALOG_STRUCT + +CATALOG(pg_matview_stat,9716,MatViewStatRelationId) +{ + Oid mvrelid BKI_LOOKUP(pg_class); /* OID of the materialized + * view */ + int64 mvrefreshcount BKI_DEFAULT(0); /* number of times the matview + * has been populated with + * real data */ + + /* + * Although mvlastrefresh is a fixed-width type, it is allowed to be NULL + * (before the first real refresh). + */ +#ifdef CATALOG_VARLEN /* variable-length fields start here */ + + timestamptz mvlastrefresh BKI_FORCE_NULL; /* timestamp of the last + * refresh that actually + * populated the view, or + * NULL. REFRESH ... WITH NO + * DATA does not update this. */ +#endif +} FormData_pg_matview_stat; + +END_CATALOG_STRUCT + +typedef FormData_pg_matview_stat * Form_pg_matview_stat; + +DECLARE_UNIQUE_INDEX_PKEY(pg_matview_stat_mvrelid_index, 9718, MatViewStatRelidIndexId, pg_matview_stat, btree(mvrelid oid_ops)); + +MAKE_SYSCACHE(MATVIEWSTATRELID, pg_matview_stat_mvrelid_index, 16); + +#endif /* PG_MATVIEW_STAT_H */ diff --git a/src/include/commands/matview.h b/src/include/commands/matview.h index 738c731c1a9..e9a435975ca 100644 --- a/src/include/commands/matview.h +++ b/src/include/commands/matview.h @@ -33,4 +33,6 @@ extern DestReceiver *CreateTransientRelDestReceiver(Oid transientoid); extern bool MatViewIncrementalMaintenanceIsEnabled(void); +extern void MatViewStatRemove(Oid relid); + #endif /* MATVIEW_H */ diff --git a/src/test/regress/expected/matview.out b/src/test/regress/expected/matview.out index 0355720dfc6..78fe6b376a1 100644 --- a/src/test/regress/expected/matview.out +++ b/src/test/regress/expected/matview.out @@ -699,3 +699,102 @@ NOTICE: relation "matview_ine_tab" already exists, skipping (0 rows) DROP MATERIALIZED VIEW matview_ine_tab; +-- pg_stat_matviews: last-refresh timestamp and refresh count +CREATE MATERIALIZED VIEW mvtest_stat_mv1 AS SELECT * FROM mvtest_t; +CREATE MATERIALIZED VIEW mvtest_stat_mv2 AS SELECT * FROM mvtest_t WITH NO DATA; +-- freshly created WITH DATA: populated once already +SELECT matviewname, last_refresh IS NOT NULL AS refreshed, refresh_count + FROM pg_stat_matviews WHERE matviewname = 'mvtest_stat_mv1'; + matviewname | refreshed | refresh_count +-----------------+-----------+--------------- + mvtest_stat_mv1 | t | 1 +(1 row) + +-- freshly created WITH NO DATA: never refreshed, but still listed +SELECT matviewname, last_refresh, refresh_count + FROM pg_stat_matviews WHERE matviewname = 'mvtest_stat_mv2'; + matviewname | last_refresh | refresh_count +-----------------+--------------+--------------- + mvtest_stat_mv2 | | 0 +(1 row) + +-- a plain REFRESH bumps the count and advances the timestamp +SELECT last_refresh AS mv1_refresh_1 FROM pg_stat_matviews + WHERE matviewname = 'mvtest_stat_mv1' \gset +REFRESH MATERIALIZED VIEW mvtest_stat_mv1; +SELECT refresh_count, + last_refresh > :'mv1_refresh_1' AS advanced + FROM pg_stat_matviews WHERE matviewname = 'mvtest_stat_mv1'; + refresh_count | advanced +---------------+---------- + 2 | t +(1 row) + +-- REFRESH ... WITH NO DATA does not touch the recorded stats +SELECT last_refresh AS mv1_refresh_2 FROM pg_stat_matviews + WHERE matviewname = 'mvtest_stat_mv1' \gset +REFRESH MATERIALIZED VIEW mvtest_stat_mv1 WITH NO DATA; +SELECT refresh_count, + last_refresh = :'mv1_refresh_2' AS unchanged + FROM pg_stat_matviews WHERE matviewname = 'mvtest_stat_mv1'; + refresh_count | unchanged +---------------+----------- + 2 | t +(1 row) + +-- a rolled-back REFRESH does not leave a trace +BEGIN; +REFRESH MATERIALIZED VIEW mvtest_stat_mv1; +SELECT refresh_count FROM pg_stat_matviews WHERE matviewname = 'mvtest_stat_mv1'; + refresh_count +--------------- + 3 +(1 row) + +ROLLBACK; +SELECT refresh_count FROM pg_stat_matviews WHERE matviewname = 'mvtest_stat_mv1'; + refresh_count +--------------- + 2 +(1 row) + +-- REFRESH ... WITH NO DATA on a never-refreshed matview still records nothing +REFRESH MATERIALIZED VIEW mvtest_stat_mv2 WITH NO DATA; +SELECT last_refresh, refresh_count + FROM pg_stat_matviews WHERE matviewname = 'mvtest_stat_mv2'; + last_refresh | refresh_count +--------------+--------------- + | 0 +(1 row) + +-- an actual REFRESH populates it +REFRESH MATERIALIZED VIEW mvtest_stat_mv2; +SELECT last_refresh IS NOT NULL AS refreshed, refresh_count + FROM pg_stat_matviews WHERE matviewname = 'mvtest_stat_mv2'; + refreshed | refresh_count +-----------+--------------- + t | 1 +(1 row) + +-- REFRESH ... CONCURRENTLY is tracked the same way as a regular refresh +CREATE UNIQUE INDEX mvtest_stat_mv1_id ON mvtest_stat_mv1 (id); +REFRESH MATERIALIZED VIEW mvtest_stat_mv1; -- re-populate after the WITH NO DATA above +SELECT refresh_count AS mv1_count_before FROM pg_stat_matviews + WHERE matviewname = 'mvtest_stat_mv1' \gset +REFRESH MATERIALIZED VIEW CONCURRENTLY mvtest_stat_mv1; +SELECT refresh_count = :mv1_count_before + 1 AS bumped + FROM pg_stat_matviews WHERE matviewname = 'mvtest_stat_mv1'; + bumped +-------- + t +(1 row) + +-- dropping the matview removes its entry +DROP MATERIALIZED VIEW mvtest_stat_mv1; +SELECT count(*) FROM pg_stat_matviews WHERE matviewname = 'mvtest_stat_mv1'; + count +------- + 0 +(1 row) + +DROP MATERIALIZED VIEW mvtest_stat_mv2; diff --git a/src/test/regress/expected/oidjoins.out b/src/test/regress/expected/oidjoins.out index 51b9608a668..8aef4f78c69 100644 --- a/src/test/regress/expected/oidjoins.out +++ b/src/test/regress/expected/oidjoins.out @@ -273,3 +273,4 @@ NOTICE: checking pg_subscription {subowner} => pg_authid {oid} NOTICE: checking pg_subscription {subserver} => pg_foreign_server {oid} NOTICE: checking pg_subscription_rel {srsubid} => pg_subscription {oid} NOTICE: checking pg_subscription_rel {srrelid} => pg_class {oid} +NOTICE: checking pg_matview_stat {mvrelid} => pg_class {oid} diff --git a/src/test/regress/expected/rules.out b/src/test/regress/expected/rules.out index 1a29d46213e..dd1215600e0 100644 --- a/src/test/regress/expected/rules.out +++ b/src/test/regress/expected/rules.out @@ -1981,6 +1981,15 @@ pg_stat_lock| SELECT locktype, fastpath_exceeded, stats_reset FROM pg_stat_get_lock() l(locktype, waits, wait_time, fastpath_exceeded, stats_reset); +pg_stat_matviews| SELECT c.oid AS relid, + n.nspname AS schemaname, + c.relname AS matviewname, + s.mvlastrefresh AS last_refresh, + COALESCE(s.mvrefreshcount, (0)::bigint) AS refresh_count + FROM ((pg_class c + LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) + LEFT JOIN pg_matview_stat s ON ((s.mvrelid = c.oid))) + WHERE (c.relkind = 'm'::"char"); pg_stat_progress_analyze| SELECT s.pid, s.datid, d.datname, diff --git a/src/test/regress/sql/matview.sql b/src/test/regress/sql/matview.sql index 934426b9ae8..fa6ef7ab129 100644 --- a/src/test/regress/sql/matview.sql +++ b/src/test/regress/sql/matview.sql @@ -318,3 +318,63 @@ EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, BUFFERS OFF) CREATE MATERIALIZED VIEW IF NOT EXISTS matview_ine_tab AS SELECT 1 / 0 WITH NO DATA; -- ok DROP MATERIALIZED VIEW matview_ine_tab; + +-- pg_stat_matviews: last-refresh timestamp and refresh count +CREATE MATERIALIZED VIEW mvtest_stat_mv1 AS SELECT * FROM mvtest_t; +CREATE MATERIALIZED VIEW mvtest_stat_mv2 AS SELECT * FROM mvtest_t WITH NO DATA; + +-- freshly created WITH DATA: populated once already +SELECT matviewname, last_refresh IS NOT NULL AS refreshed, refresh_count + FROM pg_stat_matviews WHERE matviewname = 'mvtest_stat_mv1'; + +-- freshly created WITH NO DATA: never refreshed, but still listed +SELECT matviewname, last_refresh, refresh_count + FROM pg_stat_matviews WHERE matviewname = 'mvtest_stat_mv2'; + +-- a plain REFRESH bumps the count and advances the timestamp +SELECT last_refresh AS mv1_refresh_1 FROM pg_stat_matviews + WHERE matviewname = 'mvtest_stat_mv1' \gset +REFRESH MATERIALIZED VIEW mvtest_stat_mv1; +SELECT refresh_count, + last_refresh > :'mv1_refresh_1' AS advanced + FROM pg_stat_matviews WHERE matviewname = 'mvtest_stat_mv1'; + +-- REFRESH ... WITH NO DATA does not touch the recorded stats +SELECT last_refresh AS mv1_refresh_2 FROM pg_stat_matviews + WHERE matviewname = 'mvtest_stat_mv1' \gset +REFRESH MATERIALIZED VIEW mvtest_stat_mv1 WITH NO DATA; +SELECT refresh_count, + last_refresh = :'mv1_refresh_2' AS unchanged + FROM pg_stat_matviews WHERE matviewname = 'mvtest_stat_mv1'; + +-- a rolled-back REFRESH does not leave a trace +BEGIN; +REFRESH MATERIALIZED VIEW mvtest_stat_mv1; +SELECT refresh_count FROM pg_stat_matviews WHERE matviewname = 'mvtest_stat_mv1'; +ROLLBACK; +SELECT refresh_count FROM pg_stat_matviews WHERE matviewname = 'mvtest_stat_mv1'; + +-- REFRESH ... WITH NO DATA on a never-refreshed matview still records nothing +REFRESH MATERIALIZED VIEW mvtest_stat_mv2 WITH NO DATA; +SELECT last_refresh, refresh_count + FROM pg_stat_matviews WHERE matviewname = 'mvtest_stat_mv2'; + +-- an actual REFRESH populates it +REFRESH MATERIALIZED VIEW mvtest_stat_mv2; +SELECT last_refresh IS NOT NULL AS refreshed, refresh_count + FROM pg_stat_matviews WHERE matviewname = 'mvtest_stat_mv2'; + +-- REFRESH ... CONCURRENTLY is tracked the same way as a regular refresh +CREATE UNIQUE INDEX mvtest_stat_mv1_id ON mvtest_stat_mv1 (id); +REFRESH MATERIALIZED VIEW mvtest_stat_mv1; -- re-populate after the WITH NO DATA above +SELECT refresh_count AS mv1_count_before FROM pg_stat_matviews + WHERE matviewname = 'mvtest_stat_mv1' \gset +REFRESH MATERIALIZED VIEW CONCURRENTLY mvtest_stat_mv1; +SELECT refresh_count = :mv1_count_before + 1 AS bumped + FROM pg_stat_matviews WHERE matviewname = 'mvtest_stat_mv1'; + +-- dropping the matview removes its entry +DROP MATERIALIZED VIEW mvtest_stat_mv1; +SELECT count(*) FROM pg_stat_matviews WHERE matviewname = 'mvtest_stat_mv1'; + +DROP MATERIALIZED VIEW mvtest_stat_mv2; -- 2.39.5 (Apple Git-154)
^ permalink raw reply [nested|flat] 9+ messages in thread


end of thread, other threads:[~2026-09-09 11:00 UTC | newest]

Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-07-08 16:39 Add statistics refresh materialized view Seino Yuki <seinoyu@oss.nttdata.com>
2021-09-01 14:15 ` Fujii Masao <masao.fujii@oss.nttdata.com>
2021-09-07 09:11   ` Seino Yuki <seinoyu@oss.nttdata.com>
2021-10-01 06:49     ` Michael Paquier <michael@paquier.xyz>
2024-07-04 15:43     ` Said Assemlal <sassemlal@neurorx.com>
2026-07-29 08:21       ` Rafia Sabih <rafia.pghackers@gmail.com>
2026-07-29 08:46         ` Michael Banck <mbanck@gmx.net>
2026-07-30 06:32         ` Rafia Sabih <rafia.pghackers@gmail.com>
2026-09-09 11:00           ` Rafia Sabih <rafia.pghackers@gmail.com>

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