postgresql 中的参数查看和修改方式

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

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
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值