Re: Adding CommandID to heap xlog records - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Adding CommandID to heap xlog records
Date
Msg-id YzSHDClm+rWCoz1k@momjian.us
Whole thread Raw
In response to Re: Adding CommandID to heap xlog records  (Matthias van de Meent <boekewurm+postgres@gmail.com>)
Responses Re: Adding CommandID to heap xlog records
List pgsql-hackers
On Thu, Sep 22, 2022 at 11:12:32PM +0200, Matthias van de Meent wrote:
> On Thu, 8 Sept 2022 at 23:24, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >
> > Matthias van de Meent <boekewurm+postgres@gmail.com> writes:
> > > Please find attached a patch that adds the CommandId of the inserting
> > > transaction to heap (batch)insert, update and delete records. It is
> > > based on the changes we made in the fork we maintain for Neon.
> >
> > This seems like a very significant cost increment with returns
> > to only a minuscule number of users.  We certainly cannot consider
> > it unless you provide some evidence that that impression is wrong.
> 
> Attached a proposed set of patches to reduce overhead of the inital patch.

This might be obvious to some, but the patch got a lot larger.  :-(

---------------------------------------------------------------------------

>  contrib/pg_walinspect/pg_walinspect.c        |  4 +-
>  src/backend/access/brin/brin_pageops.c       | 16 +++---
>  src/backend/access/brin/brin_xlog.c          |  8 +--
>  src/backend/access/gin/ginxlog.c             |  6 +--
>  src/backend/access/gist/gistxlog.c           |  6 +--
>  src/backend/access/hash/hash_xlog.c          |  6 +--
>  src/backend/access/heap/heapam.c             | 40 +++++++--------
>  src/backend/access/nbtree/nbtinsert.c        | 18 +++----
>  src/backend/access/nbtree/nbtpage.c          |  8 +--
>  src/backend/access/nbtree/nbtxlog.c          | 10 ++--
>  src/backend/access/rmgrdesc/brindesc.c       | 20 ++++----
>  src/backend/access/rmgrdesc/clogdesc.c       | 10 ++--
>  src/backend/access/rmgrdesc/committsdesc.c   | 10 ++--
>  src/backend/access/rmgrdesc/dbasedesc.c      | 12 ++---
>  src/backend/access/rmgrdesc/genericdesc.c    |  2 +-
>  src/backend/access/rmgrdesc/gindesc.c        |  8 +--
>  src/backend/access/rmgrdesc/gistdesc.c       |  8 +--
>  src/backend/access/rmgrdesc/hashdesc.c       |  8 +--
>  src/backend/access/rmgrdesc/heapdesc.c       | 46 ++++++++---------
>  src/backend/access/rmgrdesc/logicalmsgdesc.c |  8 +--
>  src/backend/access/rmgrdesc/mxactdesc.c      | 14 ++---
>  src/backend/access/rmgrdesc/nbtdesc.c        |  8 +--
>  src/backend/access/rmgrdesc/relmapdesc.c     |  8 +--
>  src/backend/access/rmgrdesc/replorigindesc.c |  8 +--
>  src/backend/access/rmgrdesc/seqdesc.c        |  8 +--
>  src/backend/access/rmgrdesc/smgrdesc.c       | 10 ++--
>  src/backend/access/rmgrdesc/spgdesc.c        |  8 +--
>  src/backend/access/rmgrdesc/standbydesc.c    | 12 ++---
>  src/backend/access/rmgrdesc/tblspcdesc.c     | 10 ++--
>  src/backend/access/rmgrdesc/xactdesc.c       | 34 ++++++------
>  src/backend/access/rmgrdesc/xlogdesc.c       | 28 +++++-----
>  src/backend/access/spgist/spgxlog.c          |  6 +--
>  src/backend/access/transam/clog.c            |  8 +--
>  src/backend/access/transam/commit_ts.c       |  8 +--
>  src/backend/access/transam/multixact.c       | 48 ++++++++---------
>  src/backend/access/transam/twophase.c        |  2 +-
>  src/backend/access/transam/xact.c            | 36 +++++++------
>  src/backend/access/transam/xlog.c            | 34 ++++++------
>  src/backend/access/transam/xloginsert.c      | 31 ++++++++---
>  src/backend/access/transam/xlogprefetcher.c  |  2 +-
>  src/backend/access/transam/xlogreader.c      |  2 +-
>  src/backend/access/transam/xlogrecovery.c    | 54 ++++++++++----------
>  src/backend/access/transam/xlogstats.c       |  2 +-
>  src/backend/catalog/storage.c                | 15 +++---
>  src/backend/commands/dbcommands.c            | 30 ++++++-----
>  src/backend/commands/sequence.c              |  6 +--
>  src/backend/commands/tablespace.c            |  8 +--
>  src/backend/postmaster/autovacuum.c          |  4 +-
>  src/backend/replication/logical/decode.c     | 38 +++++++-------
>  src/backend/replication/logical/message.c    |  6 +--
>  src/backend/replication/logical/origin.c     |  6 +--
>  src/backend/storage/ipc/standby.c            | 10 ++--
>  src/backend/utils/cache/relmapper.c          |  6 +--
>  src/bin/pg_resetwal/pg_resetwal.c            |  2 +-
>  src/bin/pg_rewind/parsexlog.c                | 10 ++--
>  src/bin/pg_waldump/pg_waldump.c              |  6 +--
>  src/include/access/brin_xlog.h               |  2 +-
>  src/include/access/clog.h                    |  2 +-
>  src/include/access/ginxlog.h                 |  2 +-
>  src/include/access/gistxlog.h                |  2 +-
>  src/include/access/hash_xlog.h               |  2 +-
>  src/include/access/heapam_xlog.h             |  4 +-
>  src/include/access/multixact.h               |  3 +-
>  src/include/access/nbtxlog.h                 |  2 +-
>  src/include/access/spgxlog.h                 |  2 +-
>  src/include/access/xact.h                    |  6 +--
>  src/include/access/xlog.h                    |  2 +-
>  src/include/access/xloginsert.h              |  3 +-
>  src/include/access/xlogreader.h              |  1 +
>  src/include/access/xlogrecord.h              | 11 +---
>  src/include/access/xlogstats.h               |  2 +-
>  src/include/catalog/storage_xlog.h           |  2 +-
>  src/include/commands/dbcommands_xlog.h       |  2 +-
>  src/include/commands/sequence.h              |  2 +-
>  src/include/commands/tablespace.h            |  2 +-
>  src/include/replication/message.h            |  2 +-
>  src/include/storage/standbydefs.h            |  2 +-
>  src/include/utils/relmapper.h                |  2 +-
>  78 files changed, 430 insertions(+), 412 deletions(-)

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Indecision is a decision.  Inaction is an action.  Mark Batterson




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: A potential memory leak on Merge Join when Sort node is not below Materialize node
Next
From: Tom Lane
Date:
Subject: Re: A potential memory leak on Merge Join when Sort node is not below Materialize node