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


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to