查看/设置参数值
show server_version;
server_version|
--------------|
16.2 |
show all;
name |setting |description |
-------------------------------------------+---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------+
allow_in_place_tablespaces |off |Allows tablespaces directly inside pg_tblspc, for testing. |
allow_system_table_mods |off |Allows modifications of the structure of system tables. |
application_name |DBeaver 24.0.2 - SQLEditor <Script-6.sql> |Sets the application name to be reported in statistics and logs. |
...
select name, setting, unit, source, sourcefile, sourceline, short_desc
from pg_settings
where name like '%buffers%';
name |setting|unit|source |sourcefile |sourceline|short_desc |
--------------+-------+----+------------------+---------------------------------------------------+----------+------------------------------------------------------------------+
shared_buffers|16384 |8kB |configuration file|C:/Program Files/PostgreSQL/16/data/postgresql.conf| 130|Sets the number of shared memory buffers used by the server. |
temp_buffers |1024 |8kB |default | | |Sets the maximum number of temporary buffers used by each session.|
wal_buffers |512 |8kB |default | | |Sets the number of disk-page buffers in shared memory for WAL. |
max_connections
修改配置文件 postgresql.conf;
alter system set max_connections = N;,该命令会修改配置文件 postgresql.auto.conf。
shared_buffers
修改配置文件 postgresql.conf;
alter system set shared_buffers = 'xxx';,该命令会修改配置文件 postgresql.auto.conf。
wal_buffers
修改配置文件 postgresql.conf;
alter system set wal_buffers = 'xxx';,该命令会修改配置文件 postgresql.auto.conf。
effective_cache_size
修改配置文件 postgresql.conf;
alter system set effective_cache_size = 'xxx';,该命令会修改配置文件 postgresql.auto.conf。
work_mem
SET LOCAL work_mem = '256MB';
SELECT * FROM db ORDER BY LOWER(name);
