[prev] 21 [next]

PostgreSQL Tuples (cont)

PostgreSQL stores a single block of data for tuple
  • containing a tuple header, followed by data byte[]

    typedef struct HeapTupleHeaderData // simplified
    {
      HeapTupleFields t_heap;
      ItemPointerData t_ctid;      // TID of newer version
      uint16          t_infomask2; // #attributes + flags
      uint16          t_infomask;  // flags e.g. has_null
      uint8           t_hoff;      // sizeof header incl. t_bits
      // above is fixed size (23 bytes) for all heap tuples
      bits8           t_bits[1];   // bitmap of NULLs, var.len.
      // OID goes here if HEAP_HASOID is set in t_infomask
      // actual data follows at end of struct
    } HeapTupleHeaderData;