Skip to content

Instantly share code, notes, and snippets.

@kmoppel
Created January 12, 2017 08:38
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 kmoppel/db99b0dfbd5ff05384ba09c7777f1b2f to your computer and use it in GitHub Desktop.
Save kmoppel/db99b0dfbd5ff05384ba09c7777f1b2f to your computer and use it in GitHub Desktop.
create or replace function all_queries(out q_pid int, out q_usename text, out q_query text) returns setof record as
$$
select pid, usename::text, query from pg_stat_activity
$$ language sql security definer;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment