Skip to content

Instantly share code, notes, and snippets.

@nathanwdavis
Created January 23, 2014 20:58
Show Gist options
  • Save nathanwdavis/8586650 to your computer and use it in GitHub Desktop.
Save nathanwdavis/8586650 to your computer and use it in GitHub Desktop.
What might be blocking my Postgres ALTER?
select distinct st.pid,
current_timestamp - st.query_start as locked_time,
st.state,
st.usename,
st.client_hostname,
st.application_name
from pg_locks l
inner join pg_stat_activity st on l.pid = st.pid
where st.datname = 'analytics_master'
order by current_timestamp - st.query_start desc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment