Skip to content

Instantly share code, notes, and snippets.

@kerbelp
Created September 9, 2016 21:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kerbelp/7161037e550299cfc85d5eb2072cf36e to your computer and use it in GitHub Desktop.
Save kerbelp/7161037e550299cfc85d5eb2072cf36e to your computer and use it in GitHub Desktop.
SELECT recordtime,
username,
dbname,
remotehost,
remoteport
FROM stl_connection_log
WHERE event = 'initiating session'
AND pid NOT IN (SELECT pid
FROM stl_connection_log
WHERE event = 'disconnecting session')
ORDER BY 1 DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment