postgres 为连接存储哪些信息
寻找 PostgreSQL 存储的更多连接信息。
我确实找到了这些查询:
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
但我想找出哪些脚本或 IP 正在连接或当前连接到 PostgreSQL,有什么可以捕获此信息吗?
脚本或 IP 进行过滤的即时报告
注意:打开日志记录不是我正在寻找的解决方案,更多的是我可以通过连接到数据库Postgres 版本 7.4 的
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 what 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
连接的客户端的IP地址也记录在pg_stat_activity中,就像当前运行的语句一样(如果有的话)
The IP address of the connected clients is also recorded in pg_stat_activity, just as the currently running statement (if any)