mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
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.
This commit is contained in:
@ -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
|
||||
---------------
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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. */
|
||||
|
||||
|
Reference in New Issue
Block a user