summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorTom Lane2007-09-21 21:25:42 +0000
committerTom Lane2007-09-21 21:25:42 +0000
commitcc59049daf78c3d351c1ec78fb319b5fdeb20d53 (patch)
tree74c6471e902926264b639164859c2ae69a3420ed /contrib
parent386a5d4268c7ae13510f0a40243b2277eccb6189 (diff)
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.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/pageinspect/README.pageinspect12
-rw-r--r--contrib/pageinspect/pageinspect.sql.in3
-rw-r--r--contrib/pageinspect/rawpage.c7
3 files changed, 12 insertions, 10 deletions
diff --git a/contrib/pageinspect/README.pageinspect b/contrib/pageinspect/README.pageinspect
index 88cc0209549..fc4991db641 100644
--- a/contrib/pageinspect/README.pageinspect
+++ b/contrib/pageinspect/README.pageinspect
@@ -23,14 +23,14 @@ only by superusers.
A page image obtained with get_raw_page should be passed as argument:
- test=# SELECT * FROM page_header(get_raw_page('pg_class',0));
- lsn | tli | flags | lower | upper | special | pagesize | version
- ----------+-----+-------+-------+-------+---------+----------+---------
- 0/3C5614 | 1 | 1 | 216 | 256 | 8192 | 8192 | 4
+ regression=# SELECT * FROM page_header(get_raw_page('pg_class',0));
+ lsn | tli | flags | lower | upper | special | pagesize | version | prune_xid
+ -----------+-----+-------+-------+-------+---------+----------+---------+-----------
+ 0/24A1B50 | 1 | 1 | 232 | 368 | 8192 | 8192 | 4 | 0
(1 row)
- The returned columns correspond to the fields in the PageHeaderData-struct,
- see src/include/storage/bufpage.h for more details.
+ The returned columns correspond to the fields in the PageHeaderData struct.
+ See src/include/storage/bufpage.h for details.
heap_page_items
---------------
diff --git a/contrib/pageinspect/pageinspect.sql.in b/contrib/pageinspect/pageinspect.sql.in
index 40b75dcbc02..4821f8c3a3e 100644
--- a/contrib/pageinspect/pageinspect.sql.in
+++ b/contrib/pageinspect/pageinspect.sql.in
@@ -20,7 +20,8 @@ CREATE OR REPLACE FUNCTION page_header(IN page bytea,
OUT upper smallint,
OUT special smallint,
OUT pagesize smallint,
- OUT version smallint)
+ OUT version smallint,
+ OUT prune_xid xid)
AS 'MODULE_PATHNAME', 'page_header'
LANGUAGE C STRICT;
diff --git a/contrib/pageinspect/rawpage.c b/contrib/pageinspect/rawpage.c
index 4aba08e7800..80632be9fb5 100644
--- a/contrib/pageinspect/rawpage.c
+++ b/contrib/pageinspect/rawpage.c
@@ -8,7 +8,7 @@
* Copyright (c) 2007, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/contrib/pageinspect/rawpage.c,v 1.1 2007/05/17 19:11:24 momjian Exp $
+ * $PostgreSQL: pgsql/contrib/pageinspect/rawpage.c,v 1.2 2007/09/21 21:25:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -110,8 +110,8 @@ page_header(PG_FUNCTION_ARGS)
Datum result;
HeapTuple tuple;
- Datum values[8];
- bool nulls[8];
+ Datum values[9];
+ bool nulls[9];
PageHeader page;
XLogRecPtr lsn;
@@ -152,6 +152,7 @@ page_header(PG_FUNCTION_ARGS)
values[5] = UInt16GetDatum(page->pd_special);
values[6] = UInt16GetDatum(PageGetPageSize(page));
values[7] = UInt16GetDatum(PageGetPageLayoutVersion(page));
+ values[8] = TransactionIdGetDatum(page->pd_prune_xid);
/* Build and return the tuple. */