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的穩定性也是遠近聞名的。
參考
最後更新:2017-04-01 17:00:39