PostgreSQL的HOT(Heap-Only Tuples)

磨砺技术珠矶,践行数据之道,追求卓越价值

回到上一级页面:PostgreSQL内部结构与源代码研究索引页    回到顶级页面:PostgreSQL索引页

HOT的解释:

如下的日文文档中,有几个图示,解释得比较清晰:

http://www.slideshare.net/ItagakiTakahiro/postgresql-83-update?from_search=11

在update的时候,不在index上建立新的节点,而是通过数据块中老记录指向同块的新记录方式,来减少IO读写操作。

http://www.2ndquadrant.com/static/2quad/media/pdfs/talks/Postgres_Performance_Update83.pdf

Mechanism: Don't store index entries when we
update a row that fits on the same block

不过,似乎这方面的统计信息没有办法得到,目前正在向社区提出问题,等待回答。

 

另外,这里还有一个mini vacuum的事情:

由于从index->块内旧数据行->块内旧数据行->块内最新数据的链上,

在沿着链表查找数据的过程中,如果发现旧数据行已经没有任何事务在引用,可以顺便进行清理工作,

而用像8.3版本以前那样要等vacuum来进行,故称为 mini vacuum。

 

最为详尽、权威的介绍来自于此处:

http://www.pgcon.org/2008/schedule/events/105.en.html

它提到,通过HOT,在一定程度上减轻了vacuum 的负担----其实就是被查找数据的时候,随手把“死”数据作掉了。

Prior to HOT, frequent updates on a table would bloat the table and the indexes on it, negatively impacting long-term database performance. While frequent manual or automatic vacuuming could repair the table/index bloat, the same vacuuming caused performance problems by putting additional load on the database. HOT now attempts to address these problems by reclaiming the space used by the old, dead tuples without requiring vacuuming of the table.

 

其中包含如下文档:

 

回到上一级页面:PostgreSQL内部结构与源代码研究索引页    回到顶级页面:PostgreSQL索引页

磨砺技术珠矶,践行数据之道,追求卓越价值

posted @ 2013-08-22 10:32  健哥的数据花园  阅读(2227)  评论(0编辑  收藏  举报