Re: RE: Estimating Size of Database - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: RE: Estimating Size of Database
Date
Msg-id Pine.LNX.4.30.0104130058560.1148-100000@peter.localdomain
Whole thread Raw
In response to RE: Estimating Size of Database  ("Mitesh Shah" <Mitesh.Shah@bangnetworks.com>)
List pgsql-hackers
Mitesh Shah writes:

> One follow up question.  In the example given, it says there are 36
> bytes for each row header and 4 bytes for each pointer to a tuple.  I'm
> not sure where these numbers (36 and 4) are coming from.  Are they
> standard for *every* table?  If my table has more than just two
> integers, for example, will each row header be more than 36 bytes?

More or less.  Quoth the source:

typedef struct HeapTupleHeaderData
{       Oid                     t_oid;                  /* OID of this tuple -- 4 bytes */
       CommandId       t_cmin;                 /* insert CID stamp -- 4 bytes each */       CommandId       t_cmax;
           /* delete CommandId stamp */
 
       TransactionId t_xmin;           /* insert XID stamp -- 4 bytes each */       TransactionId t_xmax;           /*
deleteXID stamp */
 
       ItemPointerData t_ctid;         /* current TID of this or newer tuple */       int16           t_natts;
     /* number of attributes */
 
       uint16          t_infomask;             /* various infos */
       uint8           t_hoff;                 /* sizeof() tuple header */
       /* ^ - 31 bytes - ^ */
       bits8           t_bits[MinHeapTupleBitmapSize / 8];       /* bit map of NULLs */
       /* MORE DATA FOLLOWS AT END OF STRUCT */
} HeapTupleHeaderData;

Most of the fields are for maintaining information required for
transaction rollback and multi-version concurrency control, in case you
can't quite decode it.  ;-)

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/



pgsql-hackers by date:

Previous
From: "Mitesh Shah"
Date:
Subject: RE: Estimating Size of Database
Next
From: Bruce Momjian
Date:
Subject: Re: Yacc / Bison difficulties