有人知道如果它是可能的(如何,如果是的话)查询PostgreSQL(9.1)中的数据库服务器设置?
Does anyone know if it's even possible (and how, if yes) to query a database server setting in PostgreSQL (9.1)?
我需要查看 max_connections (最大开放数据库连接数)设置。
I need to view the max_connections (maximum number of open db connections) setting.
推荐答案简单如下:
SHOW max_connections;这将返回当前有效的设置。请注意,它可能与 postgresql.conf 中的设置不同,因为有一个在PostgreSQL中设置运行时参数的几种方法。要在当前会话中从 postgresql.conf 重置原始设置:
This returns the currently effective setting. Be aware that it can differ from the setting in postgresql.conf as there are a couple of ways to set run-time parameters in PostgreSQL. To reset the "original" setting from postgresql.conf in your current session:
RESET max_connections;但是,不适用于此特定设置。 根据文档:
However, not applicable to this particular setting. Per documentation:
此参数只能在服务器启动时设置。
This parameter can only be set at server start.
em> settings:
To see all settings:
SHOW ALL;有关 SHOW 命令的更多信息。 如果您需要更多详细信息或想集成查询标准的 SELECT 查询,还有:
More on the SHOW command in the manual. If you need more details or want to integrate the look-up into a standard SELECT query, there is also:
SELECT * FROM pg_settings;返回与 SHOW ALL 但每个设置都有其他信息。
Returns the same result as SHOW ALL, but with additional information per setting. For your original request:
SELECT * FROM pg_settings WHERE name = 'max_connections';更多推荐
查询参数(postgresql.conf设置),例如“max
发布评论