Skip to content

Instantly share code, notes, and snippets.

@wavle
wavle / postgresql_pg_stat_activity_with_tempfiles.sql
Created November 10, 2018 14:55 — forked from ng-pe/postgresql_pg_stat_activity_with_tempfiles.sql
postgresql "pg_stat_activity" with temporary files information
-- View pg_stat_activity with temporary files informations (file list and total file size)
-- version 0.3
SELECT
pg_stat_activity.pid AS pid,
CASE WHEN LENGTH(pg_stat_activity.datname) > 16
THEN SUBSTRING(pg_stat_activity.datname FROM 0 FOR 6)||'...'||SUBSTRING(pg_stat_activity.datname FROM '........$')
ELSE pg_stat_activity.datname
END
AS database,