Skip to content

Instantly share code, notes, and snippets.

@wevtimoteo
Last active September 11, 2015 18:12
Show Gist options
  • Save wevtimoteo/f65710288532c49f40bc to your computer and use it in GitHub Desktop.
Save wevtimoteo/f65710288532c49f40bc to your computer and use it in GitHub Desktop.
SQL queries to use with PostgreSQL to monitor current executing SQL commands
-- activity.sql
select procpid, query_start, current_query from pg_stat_activity WHERE current_query <> '<IDLE>' order by query_start
-- cancel.sql
select pg_cancel_backend(procpid)
-- index_stats.sql
select * from pg_stat_user_indexes where relname='table_name';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment