暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

PostgreSQL 14 preview - 强制vacuum 加速patch, 避免heap truncate多余的动作

digoal 2021-01-04
611

作者

digoal

日期

2021-04-14

标签

PostgreSQL , failsafe vacuum SKIP heap truncate


背景

PG 14 为了防止xid wraparound的情况, 支持了强制vacuum 加速的功能

《PostgreSQL 14 preview - 支持 vacuum 强制加速参数 vacuum_failsafe_age , vacuum_multixact_failsafe_age. 防止 xid wraparound》

新增一个patch, 在使用强制加速vacuum时, 跳过heap truncate(例如末尾的全部为空的block正常可以被truncate, 但是truncate会改变文件大小, 可能还涉及inode更新, 锁等更多的额外动作, 与强制加速的理念违背, 所以PG 14 又补了一个patch, 跳过heap truncate.)

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=60f1f09ff44308667ef6c72fbafd68235e55ae27

```
Don't truncate heap when VACUUM's failsafe is in effect.
author Peter Geoghegan pg@bowt.ie
Tue, 13 Apr 2021 19:58:31 +0000 (12:58 -0700)
committer Peter Geoghegan pg@bowt.ie
Tue, 13 Apr 2021 19:58:31 +0000 (12:58 -0700)
commit 60f1f09ff44308667ef6c72fbafd68235e55ae27
tree b292538abf7696415e2df9aed2019d5777f70285 tree
parent 6c0373ab77359c94b279c4e67c91aa623841af65 commit | diff
Don't truncate heap when VACUUM's failsafe is in effect.

It seems like a good idea to bypass heap truncation when the wraparound
failsafe mechanism (which was added in commit 1e55e7d1) is in effect.

Deliberately don't bypass heap truncation in the INDEX_CLEANUP=off case,
even though it is similar to the failsafe case. There is already a
separate reloption (and related VACUUM parameter) for that.

Reported-By: Masahiko Sawada sawada.mshk@gmail.com
Discussion: https://postgr.es/m/CAD21AoDWRh6oTN5T8wa+cpZUVpHXET8BJ8Da7WHVHpwkPP6KLg@mail.gmail.com
```

PostgreSQL 许愿链接

您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.

9.9元购买3个月阿里云RDS PostgreSQL实例

PostgreSQL 解决方案集合

德哥 / digoal's github - 公益是一辈子的事.

digoal's wechat

文章转载自digoal,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论