postgresql中fork的含義

pg_relation_size ( relation regclass [fork text ] ) → bigint

Computes the disk space used by one fork” of the specified relation. (Note that for most purposes it is more convenient to use the higher-level functions pg_total_relation_size or pg_table_size, which sum the sizes of all forks.) With one argument, this returns the size of the main data fork of the relation. The second argument can be provided to specify which fork to examine:

  • main returns the size of the main data fork of the relation.

  • fsm returns the size of the Free Space Map (see Section 68.3) associated with the relation.

  • vm returns the size of the Visibility Map (see Section 68.4) associated with the relation.

  • init returns the size of the initialization fork, if any, associated with the relation,無日誌表和索引有(參見https://postgrespro.com/blog/pgsql/5967858,恢復時用到).

 

  一個表通常具有4個fork,main(第一個,數據本身,包括表和索引), fsm,vm(對所有事務都可見的頁面,僅包含凍結元素的頁面,查詢優化目的,索引沒有vm,每個頁面2位,第一位表示頁面中的所有元素對所有事務可見,用於確認是否可使用Index only scan;第二位,表示頁面是否凍結,如果凍結了,anti-wraparound vacuum不需要訪問該頁面。設置了一定成立,未設置未必不成立,pg_visibility可用來檢查實際值),init。

  vacuum與否對性能還是有較大的影響,具體可參見postgresql/lightdb vacuum對性能的影響

 

 參考:

https://habr.com/en/company/postgrespro/blog/469087/

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章