Question about heap_inplace_update and VACUUM behavior
Question about heap_inplace_update and VACUUM behavior
Hello PostgreSQL Hackers,
I am currently exploring the PostgreSQL source code to better understand the internal storage and update mechanisms. While reviewing the heap access methods, I noticed the function heap_inplace_update() in the source code with the following comment:
/* * heap_inplace_update - deprecated * * This exists only to keep modules working in back branches. Affected * modules should migrate to systable_inplace_update_begin(). */From my understanding, PostgreSQL generally follows the MVCC model, where updates create a new tuple version rather than modifying the existing tuple in place.
This raised a few questions for me:
Does PostgreSQL still support any form of in-place updates internally, or is this function strictly kept for backward compatibility?
What types of system catalog operations (if any) rely on in-place updates through
systable_inplace_update_begin()?Since in-place updates do not generate a new tuple version, how does VACUUM interact with such updates? Does it need to handle them differently compared to normal MVCC updates?
Are there any performance or concurrency considerations that influenced the decision to deprecate
heap_inplace_updatein favor of the newer APIs?
I would greatly appreciate any clarification or references to relevant documentation or design discussions.
Thank you for your time and for the incredible work on PostgreSQL.
Best regards,
Shiju
Software Developer
Currently studying PostgreSQL internals
Re: Question about heap_inplace_update and VACUUM behavior
Hi Shiju, Thanks to your interest in DBMS development and Postgres in particular. > I would greatly appreciate any clarification or references to relevant documentation or design discussions. If you go to the systable_inplace_update_begin() definition you will find that its use cases are very well documented. I recommend using a modern text editor with goto definition / goto symbol functionality e.g. VS Code or Zed. This will simplify the exploration of the code a lot. Also I believe you are on the REL_17_STABLE branch. I would recommend choosing `master` which will become REL_19 quite soon. -- Best regards, Aleksander Alekseev