暂无图片
暂无图片
暂无图片
暂无图片
暂无图片
在插入数据时可自动触发autovacumm
364
3页
1次
2020-05-26
5墨值下载
PG 13
,
在插入数据时可自动触发
autovacumm,
从而可以生成表的
vm
文件
而无需手工触发
vacumm
才能生成
.
vm
文件可以加快
VACUUM
清理的速度
.
新增的配置选项
autovacuum_vacuum_insert_threshold
控制插入数据触发
autovacuum
的的阈值
,
默认值为
1000
1.
[local:/data/run/pg13]:5130 pg13@masterdb=# show
autovacuum_vacuum_insert_threshold;
2.
autovacuum_vacuum_insert_threshold
3.
------------------------------------
4.
1000
5.
(1 row)
autovacuum_vacuum_insert_scale_factor
控制插入数据时超过什么比例会触发
autovacuum,
默认值为
20%
1.
[local:/data/run/pg13]:5130 pg13@masterdb=# show
autovacuum_vacuum_insert_scale_factor;
2.
autovacuum_vacuum_insert_scale_factor
3.
---------------------------------------
4.
0.2
5.
(1 row)
试用体验
创建数据表
1.
[local:/data/run/pg13]:5130 pg13@masterdb=# drop table
tbl1;
2.
DROP TABLE
3.
[local:/data/run/pg13]:5130 pg13@masterdb=# create table
tbl1(id int,c1 char(20));
4.
CREATE TABLE
5.
[local:/data/run/pg13]:5130 pg13@masterdb=# insert into
tbl1(id,c1) select x,'c1'||x from generate_series(1,1000000)
as x;
6.
INSERT 0 1000000
7.
[local:/data/run/pg13]:5130 pg13@masterdb=# select
pg_relation_filepath('tbl1');
8.
pg_relation_filepath
9.
----------------------
10.
base/16384/16395
11.
(1 row)
12.
[local:/data/run/pg13]:5130 pg13@masterdb=#
日志输出
,PG
自动对
tbl1
进行了分析
1.
2020-05-22 14:52:56.790 CST,,,62686,,5ec776c8.f4de,1,,2020-
05-22 14:52:56 CST,4/197,0,LOG,00000,"automatic vacuum of
table ""masterdb.public.tbl1"": index scans: 0
2.
pages: 0 removed, 7353 remain, 0 skipped due to pins, 0
skipped frozen
3.
tuples: 0 removed, 1000000 remain, 0 are dead but not yet
removable, oldest xmin: 508
4.
buffer usage: 14734 hits, 2 misses, 4 dirtied
5.
avg read rate: 0.031 MB/s, avg write rate: 0.063 MB/s
6.
system usage: CPU: user: 0.27 s, system: 0.02 s, elapsed: 0.49
s
7.
WAL usage: 7354 records, 1 full page images, 442212
bytes",,,,,,,,,"","autovacuum worker"
8.
2020-05-22 14:52:57.065 CST,,,62686,,5ec776c8.f4de,2,,2020-05-
22 14:52:56 CST,4/198,508,LOG,00000,"automatic analyze of
table ""masterdb.public.tbl1"" system usage: CPU: user: 0.16
s, system: 0.01 s, elapsed: 0.27 s",,,,,,,,,"","autovacuum
worker"
9.
[pg13@localhost 16384]$
生成了
vm
文件
of 3
5墨值下载
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文档的来源(墨天轮),文档链接,文档作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

关注
最新上传
暂无内容,敬请期待...
下载排行榜
Top250 周榜 月榜