Is there a way to get pg_stat_activity information without using an SQL connection?

送分小仙女□ 提交于 2019-12-20 03:47:40

问题


pg_stat_activity holds extremely useful information for post-mortem analysis of various issues, especially concurrency-related, and so augmenting errors or logging with this data (properly filtered and correlated) is invaluable. However querying it requires getting a database connection which might be in short supply at the very moment it's most needed.

Is there a side-channel of some sort which would allow getting that information without the additional database connection?


回答1:


Not really, but the parameter superuser_reserved_connections will help you. It defines the number of connections that are reserved for superusers precisely so that they can still connect, even if the connection limit is exhausted.

Set the value high enough and have your monitoring process connect as superuser.



来源:https://stackoverflow.com/questions/59317434/is-there-a-way-to-get-pg-stat-activity-information-without-using-an-sql-connecti

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!