Skip to content

Instantly share code, notes, and snippets.

@bulkan
Last active August 29, 2015 14:02
Show Gist options
  • Save bulkan/38ea6d546d83252121e1 to your computer and use it in GitHub Desktop.
Save bulkan/38ea6d546d83252121e1 to your computer and use it in GitHub Desktop.
/* To terminate connections of current users */
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'TARGET-db'
AND pid <> pg_backend_pid();
/* update a timestamp field setting it 1 hour in the past from now */
update mytable set "lastUpdated"=now() - interval '3 hour' ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment