postgres what information is stored for a connection
Looking to find more connection information that PostgreSQL stores.
I did find these queries:
SELECT datname, numbackends
FROM pg_stat_database
WHERE numbackends > 0
ORDER BY numbackends DESC, datname
SELECT datname, COUNT(*) AS numbackends
FROM pg_stat_activity
GROUP BY datname HAVING COUNT(*) > 0
But I'm looking to find out wha开发者_开发百科t script(s) or IP's are connecting or have current connections to PostgreSQL, is there anything that captures this information?
NOTE: Turning Logging on is not the solution I'm looking for, more of a on the fly report I can filter by the script or IP connecting to the database
Postgres version 7.4
The IP address of the connected clients is also recorded in pg_stat_activity, just as the currently running statement (if any)
SELECT usename,
application_name, -- only valid for 9.x
client_addr,
backend_start,
query_start,
current_query
FROM pg_stat_activity
精彩评论