【发布时间】:2020-01-17 18:23:40
【问题描述】:
我的数据库中有一个有点大的表,我正在向其中插入新记录。随着记录数量的增加,我开始遇到问题并且无法插入。
我的 postgresql 日志文件建议我增加 WAL 大小:
[700] LOG: checkpoints are occurring too frequently (6 seconds apart)
[700] HINT: Consider increasing the configuration parameter "max_wal_size".
我使用=# show config_file; 获得了我的配置文件的路径,并使用vim 进行了一些修改:
max_wal_senders = 0
wal_level = minimal
max_wal_size = 4GB
当我检查文件时,我看到了我所做的更改。
然后我尝试重新加载并重新启动数据库:
(我用=# show data_directory ;得到数据目录)
我尝试重新加载:
pg_ctl reload -D path
server signaled
我试过重启
pg_ctl restart -D path
waiting for server to shut down.... done
server stopped
waiting for server to start....
2020-01-17 13:08:19.063 EST [16913] LOG: listening on IPv4 address
2020-01-17 13:08:19.063 EST [16913] LOG: listening on IPv6 address
2020-01-17 13:08:19.079 EST [16913] LOG: listening on Unix socket
2020-01-17 13:08:19.117 EST [16914] LOG: database system was shut down at 2020-01-17 13:08:18 EST
2020-01-17 13:08:19.126 EST [16913] LOG: database system is ready to accept connections
done
server started
但是当我连接到数据库并检查我的设置时:
name | setting | unit | category | short_desc | extra_desc | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | sourcefile | sourceline | pending_restart
-----------------+---------+------+-------------------------------+-------------------------------------------------------------------------+------------+------------+---------+---------+---------+------------+---------------------------+----------+-----------+------------+------------+-----------------
max_wal_senders | 10 | | Replication / Sending Servers | Sets the maximum number of simultaneously running WAL sender processes. | | postmaster | integer | default | 0 | 262143 | | 10 | 10 | | | f
max_wal_size | 1024 | MB | Write-Ahead Log / Checkpoints | Sets the WAL size that triggers a checkpoint. | | sighup | integer | default | 2 | 2147483647 | | 1024 | 1024 | | | f
wal_level | replica | | Write-Ahead Log / Settings | Set the level of information written to the WAL. | | postmaster | enum | default | | | {minimal,replica,logical} | replica | replica | | | f
(3 rows)
我仍然看到旧的默认设置。
我在这里想念什么?如何让这些设置生效?
【问题讨论】:
-
你运行的是什么版本?可以分享
SELECT * FROM pg_settings吗?我想知道ALTER SYSTEM有没有找到你…… -
配置文件不一定位于数据目录中。
show config_file;带给你什么? -
@richyen 我的版本是
10.9 (Ubuntu 10.9-0ubuntu0.18.04.1)。我更新了帖子以添加SELECT * FROM pg_settings。 -
@a_horse_with_no_name
SHOW config_file;给我/etc/postgresql/10/main/postgresql.conf
标签: postgresql wal