如何列出PostgreSQL上的活动连接? [英] How to list active connections on PostgreSQL?

查看:264
本文介绍了如何列出PostgreSQL上的活动连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PostgreSQL中是否有命令选择到给定数据库的活动连接?

Is there a command in PostgreSQL to select active connections to a given database?

psql 指出我无法删除我的数据库之一,因为有活动连接,所以我想查看什么连接(以及来自哪些计算机)

psql states that I can't drop one of my databases because there are active connections to it, so I would like to see what the connections are (and from which machines)

推荐答案

哦,我刚刚在PostgreSQL论坛上找到了该命令:

Oh, I just found that command on PostgreSQL forum:

SELECT * FROM pg_stat_activity;

这篇关于如何列出PostgreSQL上的活动连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆