3

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?

  1. Do rows on a page get re-arranged to make a contiguous chunk of space for the update?

  2. 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?

3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.