Copy/Duplicate an entire Postgres database on the same server.
Stolen from TablePlus Blog [https://tableplus.com/blog/2018/04/mysql-get-size-of-tables.html], Cool product check it out here [https://tableplus.com/]! First, lets check to see if the database has active connections.. SELECT pid,usename,client_addr,wait_event_type,wait_event,state,query,backend_type FROM pg_stat_activity