Alvaro Herrera <[EMAIL PROTECTED]> writes: > So, the only callers of both has already acquired appropiate locks at > the relation level -- nobody is going to be modifying the blocks while > they proceed. So why bother locking the pages at all? Is there a > reason or is this an historical accident?
No, because operations such as checkpointing and bgwriter will feel free to write out pages that aren't exclusive-locked; they don't try to get a lock at the table level. Failing to lock the buffer would risk allowing an invalid page state to be written to disk --- which, if we then crashed before writing the WAL record for the vacuum operation, would represent unrecoverable corruption. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings