mat views stats

Jim Mlodgenski <jimmy76@gmail.com>

From: Jim Mlodgenski <jimmy76@gmail.com>
To: PgHacker <pgsql-hackers@postgresql.org>
Date: 2017-02-20T15:06:25Z
Lists: pgsql-hackers

Attachments

I've come across a number of times where the statistics on materialized
views become stale producing bad plans. It turns out that autovacuum only
touches a materialized view when it is first created and ignores it on a
refresh. When you have a materialized view like yesterdays_sales the data
in the materialized view turns over every day.

Attached is a patch to trigger autovacuum based on a matview refresh along
with a system view pg_stat_all_matviews to show information more meaningful
for materialized views.

-- Jim

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix REFRESH MATERIALIZED VIEW to report activity to the stats collector.