Find all running queries:
SELECT pid, datname, usename, query, state, now() - pg_stat_activity.query_start AS duration FROM pg_stat_activity;<br /><br />
Refresh a materialized view:
REFRESH MATERIALIZED VIEW schema_name.view_name; GRANT SELECT ON ALL SEQUENCES IN SCHEMA app TO user_name; GRANT SELECT ON ALL TABLES IN SCHEMA app TO user_name;
Remember to grant select to whatever read-only users need access or they won't be able to read this view after the refresh.
This entry was posted by and is filed under Documentation.