Query a parameter (postgresql.conf setting) like “max_connections”

早过忘川 提交于 2019-11-28 15:37:20

Can be as simple as:

SHOW max_connections;

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.

To see all settings:

SHOW ALL;

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;

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';

There is also the functional equivalent current_setting(), which can be nested in DML statements.

SELECT current_setting('max_connections');

Related:

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