1.查看参数文件的位置
使用show 命令查看,比较常用的show config_file.此还可以查看pg_settings数据字典.
test=# show config_file;
config_file
/data/pgdata/postgresql.conf
(1 row)
test=# show hba_file
test-# ;
hba_file
/data/pgdata/pg_hba.conf
(1 row)
test=# show ident_file ;
ident_file
/data/pgdata/pg_ident.conf
2.查看当前会话的参数值
可以使用show命令或者查看pg_settings字典.
使用show all可以查看全部的参数值.show 参数名查看指定参数
test=# show all;
-------------------------------------+------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------
allow_system_table_mods | off | Allows modifications of the structure of system tables.
application_name | psql | Sets the application name to be reported in statistics and logs.
archive_command | test ! -f /data/archive/%f && cp %p /data/archive/%f | Sets the shell command that will be called to archive a WAL file.
archive_mode | on | Allows archiving of WAL files using archive_command.
archive_timeout | 0 | Forces a swi

本文详细介绍了PostgreSQL数据库的参数查看与管理,包括通过`show`命令查看配置文件位置,利用`alter system`和`set`命令修改参数,以及在会话和全局层面的参数设置。还讨论了参数如`max_connections`、`shared_buffers`、`effective_cache_size`等的优化策略,强调了参数设置对性能的影响,并提供了实际操作示例。
最低0.47元/天 解锁文章
3770

被折叠的 条评论
为什么被折叠?



