From: | Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | WIP: New Page API |
Date: | 2008-08-11 16:09:57 |
Message-ID: | 48A06455.3080809@sun.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I finished first prototype of new page API. It contains several new functions like:
Pointer PageGetUpperPointer(Page page);
void PageClearPrunable(Page page);
bool PageIsComprimable(Page page);
void PageReserveLinp(Page page);
void PageReleaseLinp(Page page);
LocationIndex PageGetLower(Page page);
LocationIndex PageGetUpper(Page page);
LocationIndex PageGetSpecial(Page page);
void PageSetLower(Page page, LocationIndex lower);
void PageSetUpper(Page page, LocationIndex lower);
Page PageGetTempPage(Page page, bool copy);
Page PageGetTempPageCopySpecial(Page page);
void PageRestoreTempPage(Page tempPage, Page oldPage);
Size PageGetSpecialSize(Page page);
Size PageGetDataSize(Page page);
bool PageLayoutIsValid(Page page);
The main point of the new API is to handle multi page layout versions. The
current implementation don't uses any speed optimization and performance gap is
about 5% (big thanks to Paul van den Bogaard for benchmarking). Finally I plan
to implement hottest function like macro (or inline fn ;-) ) and because most
structure members are located on same place I will remove extra switch in the code.
I also grab number of calls by DTrace and I got following result:
<snip>
PageGetHeapFreeSpace 984
PageGetSpecialSize 1170
PageGetFreeSpace 1200
PageGetExactFreeSpace 1399
PageGetUpper 1419
PageGetLower 1618
PageGetLSN 2936
PageGetMaxOffsetNumber 5504
PageGetSpecialPointer 13534
PageGetItemId 71074
PageGetItem 76629
I plan to remove PageGetItemId and replace it with any other function like
PageGetHeapTuple and so on. The reason is that ItemId flags has been changed
between version 3 and 4. And on many times it is called like
itemId = PageGetItemId();
PageGetItem(itemId);
I'm also thinking about add following function:
PageSetXLOG(page,TLI,LSN) - it should replace PageSetLSN();PageSetTLI();
sequence in code
I'm not happy with PageSetLower() function which is used in nbtree, but no idea
yet how to improve it.
Please, let me know your comments. I attached prototype patch.
Thanks Zdenek
--
Zdenek Kotala Sun Microsystems
Prague, Czech Republic http://sun.com/postgresql
Attachment | Content-Type | Size |
---|---|---|
page_api.patch | text/x-diff | 44.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Decibel! | 2008-08-11 16:37:16 | Re: Mini improvement: statement_cost_limit |
Previous Message | Pavel Stehule | 2008-08-11 15:56:35 | Re: proposal: UTF8 to_ascii function |