Skip to content

Instantly share code, notes, and snippets.

Chenjun Shen pshen

Block or report user

Report or block pshen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:4dd92177149c256c6337
WITH table_scans as (
SELECT relid,
tables.idx_scan + tables.seq_scan as all_scans,
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes,
pg_relation_size(relid) as table_size
FROM pg_stat_user_tables as tables
all_writes as (
SELECT sum(writes) as total_writes
FROM table_scans
pshen / gist:5a6e92aa20d8c091821d
Last active Aug 29, 2015
Who is blocking? PG>9.2
View gist:5a6e92aa20d8c091821d
w.query as waiting_query, as w_pid,
w.usename as w_user,
l.query as locking_query, as l_pid,
l.usename as l_user,
t.schemaname || '.' || t.relname as tablename
from pg_stat_activity w
join pg_locks l1 on = and not l1.granted
You can’t perform that action at this time.