博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
FSM, VISIBILITY MAP AND VACUUM
阅读量:4695 次
发布时间:2019-06-09

本文共 3113 字,大约阅读时间需要 10 分钟。

Update: Heikki’s slides are !

Heikki Linnakangas gave a presentation this past Sunday at  about the improved free space map (FSM), which tracks unused space inside the database, and new visibility map, a bitmap which will indicate which data pages can be skipped during a partial VACUUM. This performance enhancement will affect all users of the upcoming 8.4 software release. You can see what the new FSM implementation looked like  from.

Despite Heikki’s modest claim during the talk that the performance tests were inconclusive, the consensus among  is that this feature will result a substantial improvement in the performance of VACUUM for tables that are large, but have few UPDATEs.

The new free space map and Visibility map (in 8.4) and autovacuum (enabled by default starting in version 8.2) are huge administrative usability improvements to version 8 of Postgres. Prior to version 8.1, VACUUM had to be scheduled outside of database system.  has been part of the core Postgres distribution for over two years, and is tunable via several .

The visibility map enables partial VACUUMs — meaning that VACUUM no longer has to examine every tuple to update the FSM. The new FSM implementation eliminates two configuration parameters, effectively automating a formerly manual configuration process.

The new FSM is stored on disk in seperate files inside of $PGDATA/base/, and is cached in shared_buffers. The result is that the max_fsm_* configuration parameters are no longer in 8.4 — Postgres is able to track and adjust this data structure without user intervention.

A few critical features of the new FSM are:

* Now a binary tree structure

* Constructed using 1 byte per heap page
* The top level shows the maximum amount of contiguous space available
* The data structure is auto-repairing and can be reconstructed from the bottom

Previously, every time that VACUUM was run, the free space map had to be reconstructed from scratch. Now, individual nodes in the map may be updated (aka “retail” updates).

Visibility map is a bitmap of heap pages which tracks which tuples on pages are visible to transactions, and therefore not available for VACUUMing.

Previously, when VACUUM ran, it *had* to look at every tuple in a table, because there was no information about which pages may not have been updated since the last VACUUM. With the visibility map, VACUUM will now be able to perform partial scans of table data, skipping pages which are marked as fully visible. Partial scans means fewer I/O operations for VACUUM, and happier database administrators.

 

 

注:老文章了,看到了学习一下。

1、以前在执行vacuum时,fsm都会重构,现在则会单独节点的更新(此处应指8.4版本)。

2、之前看到一些max_fsm_*的参数,原来在8.4之后就没有了。 

3、有了vm文件,可以方便vacuum清理时不必扫描对其他事务都可见的页。因为vacuum只清理已删除的,但又没有访问的情况。该tuple经过update或delete后,但或仍有事务没有提交,仍可见旧版本,此时是无法清理的。可以参考pg的MVCC或了解的更细一些。

 4、根据篇头的文档,vacuum仍然需要扫描全表,是因为:

Whole-table scanning VACUUMs are still needed to avoid transaction ID wraparound。

参考:

http://www.chesnok.com/daily/2009/02/10/fsm-visibility-map-and-new-vacuum-awesomeness/

https://wiki.postgresql.org/images/8/81/FSM_and_Visibility_Map.pdf

转载于:https://www.cnblogs.com/xiaotengyi/p/5065411.html

你可能感兴趣的文章
手机网站——前端开发布局技巧汇总
查看>>
[转]FTP协议的分析和扩展
查看>>
位运算解决“一个数组中,只有一个数字出现n次,其他数字出现k次”问题
查看>>
CCArray
查看>>
将node-expat扩展编译至node.exe中
查看>>
列表(list)元组(tuple)字典(dictionary)集合(set)
查看>>
Github 配置 SSH
查看>>
Refresh Baidu Zhidao Evaluate Num 1.0
查看>>
数据库插入使用参数的方法 一般步骤
查看>>
Production Order System Status
查看>>
python中将字典转换成定义它的json字符串
查看>>
MAMP pro mac 本地集成环境 php sal apache等集成软件
查看>>
PHP笔记
查看>>
C++ 文件和流
查看>>
jquery.fileupload.js 多文件上传
查看>>
BroadcastReceiver概述
查看>>
i686和x86_64的区别
查看>>
玩转TypeScript(1) --定义简单的类
查看>>
从零开始的JS生活(二)——BOM、DOM与JS中的事件
查看>>
阶段1 语言基础+高级_1-3-Java语言高级_02-继承与多态_第3节 接口_7_接口的静态方法定义...
查看>>