Ryan Lambert: Postgres Permissions and Materialized Views

Materialized views in Postgres are a handy way to persist the result
of a query to disk. This is helpful when the underlying query
is expensive and slow yet high performance SELECT queries are required.
When using materialized views
they need to be explicitly refreshed to show changes to the underlying
table. This is done through the REFRESH MATERIALIZED VIEW ;

Keeping materialized views regularly refreshed is often a delegated
to a cron job on a schedule. There is also often a need for database
users to manually refresh the data on demand. At this point many
users stub their toe on permissions because
refreshing a materialized view
can only be done by the owner of the materialized view.
This post uses a simple example to illustrate how to delegate refresh
permissions to other Postgres roles.