作者
digoal
日期
2021-01-18
标签
PostgreSQL , visibility map , copy
背景
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=7db0cd2145f2bce84cac92402e205e4d2b045bf2
copy freeze语法, 在数据导入时, freeze bit位会被实时设置, 但是visibility还需要全扫描来进行更新, 实际上copy freeze可以实时更新visilibity map. 避免重复扫描.
PG 14 copy freeze语法支持及时更新新增数据块的visibility map信息.
visibility map经常被用于vacuum , index only scan的优化.
```
Set PD_ALL_VISIBLE and visibility map bits in COPY FREEZE
author Tomas Vondra tomas.vondra@postgresql.org
Sun, 17 Jan 2021 21:11:39 +0000 (22:11 +0100)
committer Tomas Vondra tomas.vondra@postgresql.org
Sun, 17 Jan 2021 21:28:26 +0000 (22:28 +0100)
commit 7db0cd2145f2bce84cac92402e205e4d2b045bf2
tree 478bd930393c975061012a742250bf72a8d38c1c tree | snapshot
parent 0c7d3bb99f72d66ec6ac63aee4c5fe6d683eee86 commit | diff
Set PD_ALL_VISIBLE and visibility map bits in COPY FREEZE
Make sure COPY FREEZE marks the pages as PD_ALL_VISIBLE and updates the
visibility map. Until now we only marked individual tuples as frozen,
but page-level flags were not updated, so the first VACUUM after the
COPY FREEZE had to rewrite the whole table.
This is a fairly old patch, and multiple people worked on it. The first
version was written by Jeff Janes, and then reworked by Pavan Deolasee
and Anastasia Lubennikova.
Author: Anastasia Lubennikova, Pavan Deolasee, Jeff Janes
Reviewed-by: Kuntal Ghosh, Jeff Janes, Tomas Vondra, Masahiko Sawada,
Andres Freund, Ibrar Ahmed, Robert Haas, Tatsuro Ishii,
Darafei Praliaskouski
Discussion: https://postgr.es/m/CABOikdN-ptGv0mZntrK2Q8OtfUuAjqaYMGmkdU1dCKFtUxVLrg@mail.gmail.com
Discussion: https://postgr.es/m/CAMkU%3D1w3osJJ2FneELhhNRLxfZitDgp9FPHee08NT2FQFmz_pQ%40mail.gmail.com
```
PostgreSQL 许愿链接
您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.
9.9元购买3个月阿里云RDS PostgreSQL实例
PostgreSQL 解决方案集合
德哥 / digoal's github - 公益是一辈子的事.





