pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mladen Gogala <gogala.mladen@gmail.com>
To: pgsql-admin@lists.postgresql.org
Subject: Re: Transaction Size in PostgreSQL
Date: Mon, 6 Dec 2021 23:01:00 -0500
Message-ID: <06613990-9967-9304-ddba-e1fed931af80@gmail.com> (raw)
In-Reply-To: <CAGH8HirGbc_=EU3GYBWQYnofWU2y_ygjP=1gzp-j6wmE3CSMtQ@mail.gmail.com>
References: <CAGH8HirGbc_=EU3GYBWQYnofWU2y_ygjP=1gzp-j6wmE3CSMtQ@mail.gmail.com>

On 12/6/21 22:26, Sivasamy Subramaniam wrote:
> Hello Experts,
>
> I need a query or a way to find the transaction size in postgreSQL. 
> Can any one provide SQL or a method to figure this out?

How do you define transaction size? By the number of bytes it changed? 
By the duration of the transaction? By the amount of generated WAL 
entries? Maybe it's the amount of memory consumed by the transaction? 
All of these quantities could, with a reasonable justification, be 
called "transaction size". Anyway, the old adage says that size doesn't 
matter.  It's not the size of transaction that matters, regardless of 
how the size is defined, it's the magic in the optimizer. I am quoting 
from memory, I apologize if I got my quotes wrong. Why would you need 
such a measure? Are you trying to do some capacity planning for moving 
to the cloud? I have usually used things like "transactions per second" 
and measured the system response time.

You may want to try pg_stat_xact_user_tables which contains the numbers 
of updated, inserted and fetched rows. That could also be the measure of 
the transaction size. Probably the most useful way would be to build a 
measure into the application and let the application measure whatever 
you define as "transaction size".

Regards

-- 
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com






view thread (8+ messages)  latest in thread

Message-ID: <06613990-9967-9304-ddba-e1fed931af80@gmail.com>
Permalink:  ../06613990-9967-9304-ddba-e1fed931af80@gmail.com/
Also on:    postgresql.org/message-id/06613990-9967-9304-ddba-e1fed931af80@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: gogala.mladen@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: Transaction Size in PostgreSQL
  In-Reply-To: <06613990-9967-9304-ddba-e1fed931af80@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox