Re: Resetting spilled txn statistics in pg_stat_replication

From: Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Resetting spilled txn statistics in pg_stat_replication
Date: 2020-06-29 04:55:56
Message-ID: CA+fd4k7bPn2KVNoHwwptZUoKNU_0u7jBNOOC-EbfbFGwKUN0xg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 26 Jun 2020 at 17:53, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Fri, Jun 26, 2020 at 11:31 AM Masahiko Sawada
> <masahiko(dot)sawada(at)2ndquadrant(dot)com> wrote:
> >
> > On Thu, 25 Jun 2020 at 19:35, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> > >
> > > On Tue, Jun 23, 2020 at 6:39 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> > > >
> > > > On Tue, Jun 23, 2020 at 3:48 PM Tomas Vondra
> > > > <tomas(dot)vondra(at)2ndquadrant(dot)com> wrote:
> > > > >
> > > > > On Tue, Jun 23, 2020 at 10:58:18AM +0530, Amit Kapila wrote:
> > > > > >On Tue, Jun 23, 2020 at 9:32 AM Masahiko Sawada
> > > > > ><masahiko(dot)sawada(at)2ndquadrant(dot)com> wrote:
> > > > > >>
> > > > > >> On Sun, 21 Jun 2020 at 06:57, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com> wrote:
> > > > > >> >
> > > > > >> > >
> > > > > >> > >What if the decoding has been performed by multiple backends using the
> > > > > >> > >same slot? In that case, it will be difficult to make the judgment
> > > > > >> > >for the value of logical_decoding_work_mem based on stats. It would
> > > > > >> > >make sense if we provide a way to set logical_decoding_work_mem for a
> > > > > >> > >slot but not sure if that is better than what we have now.
> > > > > >> > >
> > > > > >>
> > > > > >> I thought that the stats are relevant to what
> > > > > >> logical_decoding_work_mem value was but not with who performed logical
> > > > > >> decoding. So even if multiple backends perform logical decoding using
> > > > > >> the same slot, the user can directly use stats as long as
> > > > > >> logical_decoding_work_mem value doesn’t change.
> > > > > >>
> > >
> > > Today, I thought about it again, and if we consider the point that
> > > logical_decoding_work_mem value doesn’t change much then having the
> > > stats at slot-level would also allow computing
> > > logical_decoding_work_mem based on stats. Do you think it is a
> > > reasonable assumption that users won't change
> > > logical_decoding_work_mem for different processes (WALSender, etc.)?
> >
> > FWIW, if we use logical_decoding_work_mem as a threshold of starting
> > of sending changes to a subscriber, I think there might be use cases
> > where the user wants to set different logical_decoding_work_mem values
> > to different wal senders. For example, setting a lower value to
> > minimize the latency of synchronous logical replication to a near-site
> > whereas setting a large value to minimize the amount of data sent to a
> > far site.
> >
>
> How does setting a large value can minimize the amount of data sent?
> One possibility is if there are a lot of transaction aborts and
> transactions are not large enough that they cross
> logical_decoding_work_mem threshold but such cases shouldn't be many.

Yeah, this is what I meant.

I agree that it would not be a common case that the user sets
different values for different processes. Based on that assumption, I
also think having the stats at slot-level is a good idea. But I might
want to have the reset function.

Regards,

--
Masahiko Sawada http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2020-06-29 05:00:28 Re: POC: postgres_fdw insert batching
Previous Message higuchi.daisuke@fujitsu.com 2020-06-29 04:35:11 [Bug fix]There is the case archive_timeout parameter is ignored after recovery works.