mat views stats

From: Jim Mlodgenski <jimmy76(at)gmail(dot)com>
To: PgHacker <pgsql-hackers(at)postgresql(dot)org>
Subject: mat views stats
Date: 2017-02-20 15:06:25
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-hackers

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

Attachment Content-Type Size
stat_matview.patch text/x-patch 20.8 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-02-20 15:37:41 Re: [PATCH] Suppress Clang 3.9 warnings
Previous Message Kuntal Ghosh 2017-02-20 15:05:15 Re: Passing query string to workers