This site is about a previous instance of this event. For the current event, please see the updated site.

Schedule - PGConf.EU 2016

The Future is CSN

Date: 2016-11-02
Time: 14:00–14:50
Room: Omega
Level: Advanced

Current MVCC model of PostgreSQL relies on snapshots which contain enumeration of transactions which are currently running. This solution served very well when it was invented. That time, typical server could have 2 or 4 sockets with single-core processors at maximum.

Much time has elapsed since then. Nowadays, you can't surprise anyone with 72-cores machine. And we have really reached the limitation of our snapshot representation. Consistent snapshot taking require shared ProcArrayLock. On heavily loaded system, contention for ProcArrayLock is very high. Even group commit optimization in 9.6 doesn't remove this problem.

The possible solution is switching to commit sequence numbers (CSNs). When using CSN one can easily determine which of them commits earlier just by comparing their CSNs. This approach completely removes contention for ProcArrayLock during taking snapshots. However, another problem arises: we need really fast XID => CSN map. Slow map in this place can completely nullify advantages of CSN approach.

In this talk I'll present a patch with elegant solution of XID => CSN map problem. Idea is to minimize usage of this map the same way we minimize clog accesses. While setting hint bits we can rewrite XIDs with CSNs. That arises set of technical problems but all of them appears to be solvable.


Alexander Korotkov