Thread: Inquiry on Future Plans for Enhancements to PostgreSQL MVCC Model and Vacuum Process

Hi hackers,

I’m currently studying the internals of PostgreSQL, specifically the vacuum process. 

I've learned that PostgreSQL’s MVCC model has had issues in the past, such as XID wraparound and table bloating problems. It seems that these issues may have been mitigated by implementing features like autovacuum.

However, from my understanding, the current MVCC model seems to have more negative effects than positive ones. Is there any plan to modify the MVCC model in future versions?

I’m still learning about PostgreSQL, so there may be some inaccuracies in my understanding. If there are, please let me know.

Thank you

On 01/11/2024 14:56, 송영욱 wrote:
> Hi hackers,
> 
> I’m currently studying the internals of PostgreSQL, specifically the 
> vacuum process.
> 
> I've learned that PostgreSQL’s MVCC model has had issues in the past, 
> such as XID wraparound and table bloating problems. It seems that these 
> issues may have been mitigated by implementing features like autovacuum.
> 
> However, from my understanding, the current MVCC model seems to have 
> more negative effects than positive ones. Is there any plan to modify 
> the MVCC model in future versions?

There are no ongoing efforts for a big rewrite. If we were writing 
PostgreSQL from scratch, we'd probably do many things differently, but 
it's very difficult to change something so ingrained as MVCC. Even if 
you come up with a scheme that works better for 95% of users, that last 
5% of users will be unhappy, which is bad. That means either maintaining 
two systems forever, or throwing some users under the bus.

There are always efforts further to mitigate the issues though. See this 
thread 
https://www.postgresql.org/message-id/CAJ7c6TND0bCnwU1SmxTsFewK4XJGBep343vf+T+GQ-a5S5hC0w@mail.gmail.com 
for an effort to switch to 64-bit XIDs, for example. That largely 
eliminates XID wraparound.

There was a notable project called zheap a few years ago to replace the 
heap implementation with a new table AM 
(https://wiki.postgresql.org/wiki/Zheap). AFAIK no one is working on 
that at the moment however. Alexander Korotkov's OrioleDb is also worth 
mentioning. It's an even bigger rewrite with various pros and cons 
however, which means it's unlikely to replace PostgreSQL's current MVCC.

My personal favorite in this area is TED 
(https://www.postgresql.org/message-id/55511D1F.7050902%40iki.fi). 
That's a pretty modest change to how MVCC currently works, so it won't 
solve all the issues, but it's a small enough change that I think 
there's a better chance of getting it done. However, it's just an idea; 
there has been zero work on actually implementing it.

At the end of the day, this is an open source project, so the future 
depends on what people decide to work on and submit patches for. The 
above are just the notable efforts that I'm aware of.

-- 
Heikki Linnakangas
Neon (https://neon.tech)