查看某个参数值,比如参数statement_timeout
postgres=# show statement_timeout;
statement_timeout
-------------------
0
(1 row)
想修改参数statement_timeout为10s,并永久生效:
方法1(select语句法):
postgres=# alter system set statement_timeout='10s';
ALTER SYSTEM
postgres=# select pg_reload_conf();
pg_reload_conf
----------------
t
(1 row)
postgres=# \q
[root@pg2 ~]# psql
psql (11.3)
Type "help" for help.
postgres=# show statement_timeout;
statement_timeout
-------------------
10s
(1 row)
备注:
执行select pg_reload_conf();命令优先加载的是postgresql.auto.conf文件的配置
方法2(reload配置文件法):
# su - postgres
查看数据文件路径:
postgres=# show data_directory;
data_directory
----------------------
/data/pgdata/11/data
(1 row)
postgres= \! vi /data/pgdata/11/data/postgresql.conf
文件末尾添加一行
statement_timeout = '10s'
:x保存退出
\! pg_ctl -D /data/pgdata/11/data reload
server signaled
再次查看参数值:
postgres=# show statement_timeout;
statement_timeout
-------------------
10s
(1 row)
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/15498/viewspace-2758511/ ,如需转载,请注明出处,否则将追究法律责任。