Skip to content

Instantly share code, notes, and snippets.

@hamdouni
Last active April 17, 2019 11:29
Show Gist options
  • Save hamdouni/b1ff5883bd875a962a03d1bc592903a8 to your computer and use it in GitHub Desktop.
Save hamdouni/b1ff5883bd875a962a03d1bc592903a8 to your computer and use it in GitHub Desktop.

Postres Tips on Terminal

Show running queries (ala Mysql processlist)

SELECT pid,datname,usename,application_name,client_hostname,client_port,backend_start,query_start,query 
FROM pg_stat_activity 
WHERE state <> 'idle' 
AND pid<>pg_backend_pid();

Don't truncate query (need restart postgres)

ALTER SYSTEM SET track_activity_query_size = 16384;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment