| From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> | 
|---|---|
| To: | Robert Haas <robertmhaas(at)gmail(dot)com> | 
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)2ndquadrant(dot)com>, Kevin Grittner <kgrittn(at)ymail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: changeset generation v5-01 - Patches & git tree | 
| Date: | 2013-06-28 15:52:15 | 
| Message-ID: | 20130628155215.GV3757@eldon.alvh.no-ip.org | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
Alvaro Herrera escribió:
> An INSERT wal record is:
> 
> typedef struct xl_heap_insert
> {
> 	xl_heaptid	target;			/* inserted tuple id */
> 	bool		all_visible_cleared;	/* PD_ALL_VISIBLE was cleared */
> 	/* xl_heap_header & TUPLE DATA FOLLOWS AT END OF STRUCT */
> } xl_heap_insert;
Oops. xl_heaptid is not 6 bytes, but instead:
typedef struct xl_heaptid
{
	RelFileNode node;
	ItemPointerData tid;
} xl_heaptid;
typedef struct RelFileNode
{
	Oid			spcNode;
	Oid			dbNode;
	Oid			relNode;
} RelFileNode;		/* 12 bytes */
typedef struct ItemPointerData
{
	BlockIdData ip_blkid;
	OffsetNumber ip_posid;
};			/* 6 bytes */
typedef struct BlockIdData
{
	uint16		bi_hi;
	uint16		bi_lo;
} BlockIdData;	/* 4 bytes */
typedef uint16 OffsetNumber;
There's purposely no alignment padding anywhere, so xl_heaptid totals 22 bytes.
Therefore,
> So the fixed part is just 22 bytes + 5 bytes; tuple data follows that.
> So adding four more bytes could indeed be significant (but by how much,
> depends on the size of the tuple data).
4 extra bytes on top of 27 is 14% of added overhead (considering only
the xlog header.)
-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Robert Haas | 2013-06-28 15:55:03 | Re: Request for Patch Feedback: Lag & Lead Window Functions Can Ignore Nulls | 
| Previous Message | Pavel Stehule | 2013-06-28 15:49:28 | Re: Review: query result history in psql |