Maintenance

  • Home
  • Log in
  • « PostgreSQL XML dump
  • Siberian expedition site »

PostgreSQL: handy SQL

Posted by gregster on 05 Dec 2019 in Documentation

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 Greg and filed under Documentation.

Maintenance

This blog is the location for all work involving software and hardware maintenance, updates, installs, etc., both routine and urgent.
  • Home
  • Recently
  • Archives
  • Categories

Search

Categories

  • All
  • Announcements
  • Hit by a bus
  • Labs
    • Activity log
    • Documentation
  • Notes
  • R & D
    • Activity log
    • Documentation
  • Servers
    • Activity log
    • Documentation
  • Tasks

All blogs

  • Academic
  • AdaptiveDB
  • Admin
  • Announcements
  • CanMys
  • Cascade
  • CGWP
  • ColDesp
  • Depts
  • DVPP
  • Endings
  • HCMC Blogs
  • Landscapes
  • LEMDO
  • Linguistics
  • Maint
  • LondonMap
  • Mariage
  • MoM
  • Moses
  • Pro-D
  • Projects
  • ScanCan
  • HumsSites
  • Wendat

This collection ©2023 by admin • Help • RWD CMS