From cc59049daf78c3d351c1ec78fb319b5fdeb20d53 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 21 Sep 2007 21:25:42 +0000 Subject: Improve handling of prune/no-prune decisions by storing a page's oldest unpruned XMAX in its header. At the cost of 4 bytes per page, this keeps us from performing heap_page_prune when there's no chance of pruning anything. Seems to be necessary per Heikki's preliminary performance testing. --- doc/src/sgml/storage.sgml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/storage.sgml b/doc/src/sgml/storage.sgml index a66aeb2584e..93950dde297 100644 --- a/doc/src/sgml/storage.sgml +++ b/doc/src/sgml/storage.sgml @@ -1,4 +1,4 @@ - + @@ -416,7 +416,7 @@ Item PageHeaderData - 20 bytes long. Contains general information about the page, including + 24 bytes long. Contains general information about the page, including free space pointers. @@ -449,7 +449,7 @@ data. Empty in ordinary tables. - The first 20 bytes of each page consists of a page header + The first 24 bytes of each page consists of a page header (PageHeaderData). Its format is detailed in . The first two fields track the most recent WAL entry related to this page. Next is a 2-byte field @@ -459,7 +459,7 @@ data. Empty in ordinary tables. from the page start to the start of unallocated space, to the end of unallocated space, and to the start of the special space. - The last 2 bytes of the page header, + The next 2 bytes of the page header, pd_pagesize_version, store both the page size and a version indicator. Beginning with PostgreSQL 8.3 the version number is 4; @@ -471,6 +471,8 @@ data. Empty in ordinary tables. versions, but the layout of heap row headers has.) The page size is basically only present as a cross-check; there is no support for having more than one page size in an installation. + The last field is a hint that shows whether pruning the page is likely + to be profitable: it tracks the oldest un-pruned XMAX on the page. @@ -530,6 +532,12 @@ data. Empty in ordinary tables. 2 bytes Page size and layout version number information + + pd_prune_xid + TransactionId + 4 bytes + Oldest unpruned XMAX on page, or zero if none + -- cgit v1.2.3