"Tom Lane" <tgl@sss.pgh.pa.us> writes
>
> I very seriously doubt that there would be *any* win, and I doubt even
> more that it could possibly be worth the klugery you'd have to do to
> make it happen. Bear in mind that index access methods are two API
> layers away from md.c --- how will you translate this into something
> that makes sense in the context of bufmgr's API?
>
Index access or heap access doesn't matter. The imaginary plan is like this:
-- change 1 --
/* md.c */
mdextend()
{ mdextend_several_pages(); add_pages_to_FSM();
}
-- change 2 --
/** Any places hold relation extension lock*/
if (needLock) LockPage(relation, 0, ExclusiveLock);
/* ADD: check again here */
if (InvalidBlockNumber != GetPageWithFreeSpace()) UnlockPage(relation, 0, ExclusiveLock);
/* I have to do the extension */
buffer = ReadBuffer(relation, P_NEW);
Above code is quite like how we handle xlogflush() currently.