Lists: | pgsql-hackers |
---|
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 |
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: | Markus Wanner <markus(at)bluegap(dot)ch> |
---|---|
To: | Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: WIP: New Page API |
Date: | 2008-08-12 08:14:32 |
Message-ID: | 48A14668.1090008@bluegap.ch |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Hi,
Zdenek Kotala wrote:
> I finished first prototype of new page API.
This might seem obvious to you, but could you please describe the
problem you are trying to solve with this new page API? How does it
relate to the relation forks, that have just been committed?
Regards
Markus
From: | Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM> |
---|---|
To: | Markus Wanner <markus(at)bluegap(dot)ch> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: WIP: New Page API |
Date: | 2008-08-12 09:38:16 |
Message-ID: | 48A15A08.5070306@sun.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Markus Wanner napsal(a):
> Hi,
>
> Zdenek Kotala wrote:
>> I finished first prototype of new page API.
>
> This might seem obvious to you, but could you please describe the
> problem you are trying to solve with this new page API? How does it
> relate to the relation forks, that have just been committed?
>
Hi Markus,
It is not related to fork maps. The idea is to learn PostgreSQL process to read
old data page structures. It is part of in-place upgrade and it was discussed on
PGCon this year. You can see more info on
http://wiki.postgresql.org/wiki/In-place_upgrade
http://www.pgcon.org/2008/schedule/events/87.en.html
This is prototype of first part. Multi versions tuple processing and tuple size
limits are next part.
Zdenek
From: | Markus Wanner <markus(at)bluegap(dot)ch> |
---|---|
To: | Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: WIP: New Page API |
Date: | 2008-08-12 09:43:22 |
Message-ID: | 48A15B3A.8050507@bluegap.ch |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Hi Zdenek,
Zdenek Kotala wrote:
> It is not related to fork maps. The idea is to learn PostgreSQL process
> to read old data page structures. It is part of in-place upgrade and it
> was discussed on PGCon this year. You can see more info on
>
> http://wiki.postgresql.org/wiki/In-place_upgrade
> http://www.pgcon.org/2008/schedule/events/87.en.html
Ah, that's where the idea is coming from. Thanks for the pointers.
Regards
Markus Wanner