閱讀903 返回首頁    go 阿裏雲 go 技術社區[雲棲]


PostgreSQL 10.0 preview 性能增強 - GIN索引vacuum鎖降低

標簽

PostgreSQL , 10.0 , GIN vacuum , 鎖範圍降低


背景

如果你發現你的CPU沒怎麼用,但是壓力就是上不去,很大可能是鎖等待造成的(perf可以觀察),鎖在數據庫優化中是一個比較永恒的話題。

以往在vacuum GIN索引clean posting tree時,需要鎖整個posting tree,10.0改進了這塊的鎖,現在隻鎖一個subtree。

在較大的GIN KEY被更新後,清除posting tree時,鎖衝突更小了。

Reduce page locking in GIN vacuum  
  
GIN vacuum during cleaning posting tree can lock this whole tree for a long  
time with by holding LockBufferForCleanup() on root. Patch changes it with  
two ways: first, cleanup lock will be taken only if there is an empty page  
(which should be deleted) and, second, it tries to lock only subtree, not the  
whole posting tree.  
  
Author: Andrey Borodin with minor editorization by me  
Reviewed-by: Jeff Davis, me  
https://commitfest.postgresql.org/13/896/  

這個patch的討論,詳見郵件組,本文末尾URL。

PostgreSQL社區的作風非常嚴謹,一個patch可能在郵件組中討論幾個月甚至幾年,根據大家的意見反複的修正,patch合並到master已經非常成熟,所以PostgreSQL的穩定性也是遠近聞名的。

參考

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=218f51584d5a9fcdf702bcc7f54b5b65e255c187

最後更新:2017-04-01 17:00:39

  上一篇:go phantomjs技巧之將html頁麵轉換為pdf文件
  下一篇:go 3月29日雲棲精選夜讀:阿裏“NASA”首個重磅武器亮相——機器學習平台PAI2.0