This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing a use of the pg_backend_pid function to get your current Process ID or Session ID in PostgreSQL.
When we are writing any DBA utility related script, I would suggest, please log current process id in a log file.
When you are executing multiple DBA commands, it may difficult to find process id for those running commands from the table pg_stat_activity.
Naturally, we can use pg_backend_pid() to get current process id.
1 |
SELECT pg_backend_pid() |