有关 PostgreSQL 服务重新加载的文档不会中断打开的事务?

Documentation on PostgreSQL service reload not interrupting open transactions?

我在生产环境中有一个 9.5 版的 PostgreSQL 数据库,该数据库的流量持续不断。我需要更改 pg_hba.conf 文件中的值。我在测试服务器上确认过,重载postgresql服务即可生效。

我在其他帖子和网站上看到,调用 pg_ctl reload 不会导致 postgresql 中的实时连接中断。例如 https://dba.stackexchange.com/questions/41517/is-it-safe-to-call-pg-ctl-reload-while-doing-heavy-writes

但我试图找到调用 pg_ctl reloadservice postgresql-9.5 reload 不会中断或影响任何打开的事务或正在进行的数据库查询的具体文档。

这里是对的from the horses mouth

reload mode simply sends the postgres process a SIGHUP signal, causing it to reread its configuration files (postgresql.conf, pg_hba.conf, etc.). This allows changing of configuration-file options that do not require a complete restart to take effect.

许多其他服务器(包括 Apache、NGINX 等)使用此信号来重新读取配置文件,而不会断开打开的连接。

如果您不服气,请在打开 psql 客户端或 pgadmin 或其他任何版本后尝试此操作

START TRANSACTION;
/* open the console and do /etc/init.d/postgrsql reload or equivalent for your system */
INSERT INTO my_table(id,name) value(1,'1');
COMMIT;

如果客户端已断开连接,您将收到通知。