PostgreSQL:如何重置配置参数?

PostgreSQL: how to reset config parameter?

postgresql.config: log_min_duration_statement = -1

客户甲:

SELECT set_config('log_min_duration_statement', '30000', false);
SELECT current_setting('log_min_duration_statement');
-----
30s

客户乙:

SELECT current_setting('log_min_duration_statement');
-----
-1

客户端B变化postgresql.config: log_min_duration_statement = 60000

select pg_reload_conf();
SELECT current_setting('log_min_duration_statement');
---
1 min

===

好的, 客户端 A 如何在不关闭连接的情况下重置其设置并使用 postgresql.config 文件中的当前参数值? IE。客户 A

select pg_reload_conf(); 

但他仍然有之前设定的 30 秒

https://www.postgresql.org/docs/current/static/sql-reset.html

RESET — restore the value of a run-time parameter to the default value

reset log_min_duration_statement

还有https://www.postgresql.org/docs/current/static/functions-admin.html

set_config sets the parameter setting_name to new_value. If is_local is true, the new value will only apply to the current transaction. If you want the new value to apply for the current session, use false instead. The function corresponds to the SQL command SET.

换句话说,您不需要 pg_reload_config() - 因为您仅在会话级别更改设置。修改 ponstgres.conf

后才需要重新加载

同上link:

pg_reload_conf() Cause server processes to reload their configuration files