Robert Haas escribió:
> On Fri, Jun 28, 2013 at 10:49 AM, Tom Lane <t...@sss.pgh.pa.us> wrote:
> > Robert's idea sounds fairly reasonable to me; another 4 bytes per
> > insert/update/delete WAL entry isn't that big a deal, ...
> 
> How big a deal is it?  This is a serious question, because I don't
> know.  Let's suppose that the average size of an XLOG_HEAP_INSERT
> record is 100 bytes.  Then if we add 4 bytes, isn't that a 4%
> overhead?  And doesn't that seem significant?

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;

typedef struct xl_heap_header
{
        uint16          t_infomask2;
        uint16          t_infomask;
        uint8           t_hoff;
} xl_heap_header;

So the fixed part is just 7 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).  Adding a new pg_class index
would be larger in the sense that there are more WAL records, and
there's the extra vacuuming traffic; but on the other hand that would
only happen when tables are created.  It seems safe to assume that in
normal use cases the ratio of tuple insertion vs. table creation is
large.

The only idea that springs to mind is to have the new pg_class index be
created conditionally, i.e. only when logical replication is going to be
used.

-- 
Á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