Does HOT Update re-arrange existing rows on a page to create a contiguous space? For example, on a 8kb page:


4 rows are created, each 2kb
Row 3 is deleted
Row 1 is updated to a size of 3kb


There is no contiguous chunk of 3kb space on the page, so what happens?


Do rows on a page get re-arranged to make a contiguous chunk of space for the update?
If so, then do indexes need to be updated to point to the slightly different locations? Or does it not matter as long as they're still on the same page?
No, HOT doesn't defragment pages. The cost of doing the needed index updates would be excessive.

PostgreSQL would write the new version of row 1 to a new page.