Postgresql: Tracking what's going on in the postgres db


select datname, waiting, query from pg_stat_activity where state = 'active' and pid != pg_backend_pid(); \watch 10







Continue with more experiment.
The script will only track when the query is parsing. Once it is complete or re-run, if the return data to be captured from the buffer, it will return nothing. Take a look at the 3 screenshots. However, this script is still good to catch the session the very first time but may not be a reliable script to gauge what's going on later.




Script taken from Postgresql Up and Running - Regina Obe and Leo Hsu.

No comments:

Post a Comment