pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Laetitia Avrot <laetitia.avrot@gmail.com>
Cc: Japin Li <japinli@hotmail.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: John Naylor <john.naylor@enterprisedb.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: Statistics updates is delayed when using `commit and chain`
Date: Thu, 28 Jul 2022 17:26:27 -0400
Message-ID: <3554911.1659043587@sss.pgh.pa.us> (raw)
In-Reply-To: <CAB_COdiHgHsUb7qxftTe9S-fagXr3Xv+Grw5rcdjwvu2pYy1uA@mail.gmail.com>
References: <CAB_COditjdhpZ4j=mZ3YG-uG=bqNtXWcBSAkwEJu3cX1X5myOA@mail.gmail.com>
	<MEYP282MB166920830D2969428D7028EBB6189@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM>
	<MEYP282MB1669EDFA7400DF3671400D27B6189@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM>
	<CAFBsxsHPm+CvjKGM+Whmxx0UWTCk8-meU44YcB9ya2xbw1+0Kw@mail.gmail.com>
	<MEYP282MB16691D91C25CB36079C9AC19B6179@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM>
	<CAB_COdjsWH+tjJHa4=FyUeSs+nCGegofiJwFmKzX+=xsGsP_Bw@mail.gmail.com>
	<MEYP282MB1669494707E6A49C2AC763FEB6159@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM>
	<CAFBsxsGbUgeGke_xEWfrnWqoL2U1LDCA2O5bMRr-0m8UxPqyxA@mail.gmail.com>
	<2950681.1626103840@sss.pgh.pa.us>
	<MEYP282MB1669840B952A11A638AEAA67B6139@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM>
	<3453636.1626232720@sss.pgh.pa.us>
	<CAKFQuwYnpkDkeKHh7xwMAUqarcYiw9QDg8+Umz7THmEbCH7SzA@mail.gmail.com>
	<3455196.1626234760@sss.pgh.pa.us>
	<CAKFQuwaTDMYW0v2cv+CxLfnyJ_OAh=Pc0YKvD8f3xc3DtB_LHQ@mail.gmail.com>
	<CAKFQuwZSi6vWEUtZKQhqzHj8FeWtgon=HJ-BGLfpRwjErpwKGw@mail.! gmail.com>
	<MEYP282MB16691F2B962B05BB1AC5C151B6139@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM>
	<CAB_COdjhzA+9URWOekr3s=J-+kMsUQDcjae2rF00Z5X-jDKzuA@mail.gmail.com>
	<MEYP282MB16691A6E80DF769F04BF9EB0B6E99@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM>
	<CAB_COdiHgHsUb7qxftTe9S-fagXr3Xv+Grw5rcdjwvu2pYy1uA@mail.gmail.com>

Laetitia Avrot <laetitia.avrot@gmail.com> writes:
> [ v3-0001-update-table-stats-after-commit-and-chain.patch ]

I took a quick look at this.  If we're going to move the responsibility
for pushing out stats to transaction commit, then I think what we want
to do is put the call somewhere near the end of CommitTransaction.
Maybe right after AtCommit_Notify, because that has the same spirit
of sending out info about our having committed to other backends.
(The pgstat_report_xact_timestamp call would need to be moved up to
before that, I think, but that sure looks like it was inserted with
the aid of a dartboard anyway.  It certainly doesn't square with the
immediately preceding comment about "purely internal" cleanup.)
AbortTransaction and probably PrepareTransaction the same.

Having done that, rather than adding more pgstat_report_stat calls
we could get rid of most of them.  I see a bunch of random calls right
after various CommitTransactionCommand calls, which we'd not need anymore.
We probably still want the one in PostgresMain, but it needs some
rethinking, because we only want that one to do something when the timer
fires saying that we've slept too long without sending stats.

As for the NOTIFY business, I'm not impressed with putting duplicate
boilerplate into half a dozen different places.  I think the discussion
in ref/notify.sgml covers this already, or if not, that's the one place
to fix it.  The place I actually thought could use more attention is the
wire protocol spec in protocol.sgml.  In any case, I'd rather see that
as a separate patch, because it's unrelated.

			regards, tom lane





view thread (29+ messages)  latest in thread

Message-ID: <3554911.1659043587@sss.pgh.pa.us>
Permalink:  ../3554911.1659043587@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3554911.1659043587@sss.pgh.pa.us

 · 

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-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, laetitia.avrot@gmail.com, japinli@hotmail.com, david.g.johnston@gmail.com, john.naylor@enterprisedb.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: Statistics updates is delayed when using `commit and chain`
  In-Reply-To: <3554911.1659043587@sss.pgh.pa.us>

* 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