Check real sizes of columns in tables

Do you need to know which columns takes most disk space in your tables? Here is one useful statement: with srcdata as ( select table_schema||'.'||table_name as _table, column_name as _column, count(column_name) over (partition by table_schema, table_name) as...

Drop all versions of a function

Do you need to drop all existing versions of some function without knowing anything about parameters? Try this: do $$ declare _rec record; begin for _rec in select 'drop function if exists '||ns.nspname||'.'||p.proname||'('||pg_catalog.<tt...

Locks on objects with relationships

(added version for PG 9.6+) If you want to check for specific object – specify it in WHERE clause. Explanations for the content of the result: connection which locks is selected at the top, connections which waits for lock a bellow every connection has also its...