查询参数(postgresql.conf设置),例如“max

编程入门 行业动态 更新时间:2024-10-27 07:16:38
本文介绍了查询参数(postgresql.conf设置),例如“max_connections”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有人知道如果它是可能的(如何,如果是的话)查询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

本文发布于:2023-10-15 11:54:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1494265.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:参数   postgresql   max   conf

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!