3

I would like to keep a record of when various Postgres materialised views are refreshed. As far as I can see there are no built in logs. The next obvious choice is to create a trigger, however it seems that triggers cannot be set on postgres materialized views. I'm running out of options. Can you recommend a way to do this without reaching up into the application layer?

Many thanks in advance. Max.

Max Murphy
  • 311
  • 3
  • 6

1 Answers1

1

Possible solution in 2021:

There is an extension mv_stats that captures MV (Materialized View) statistics. It adds triggers for "CREATE MATERIALIZED VIEW", "ALTER MATERIALIZED VIEW", "REFRESH MATERIALIZED VIEW" and then records timestamps when they are called for a MV.

Tracking the refresh Performance of Materialized Views with mv_stat in PostgreSQL

Gitlab: https://gitlab.com/ongresinc/extensions/mv_stats/

mikatuo
  • 111
  • 4