Removal of unnecessary CommandCounterIncrement() when doing ON COMMIT DELETE ROWS

Started by Michael Paquierover 7 years ago3 messageshackers
Jump to latest
#1Michael Paquier
michael@paquier.xyz

Hi all,

When doing a set of ON COMMIT DELETE ROWS actions for relations, there
is a CCI happening after each truncation:
@@ -13334,10 +13334,8 @@ PreCommit_on_commit_actions(void)
    * exists at truncation time.
    */
    if (oids_to_truncate != NIL)
-   {
        heap_truncate(oids_to_truncate);
-       CommandCounterIncrement();  /* XXX needed? */
-   }

This has been visibly introduced by f9b5b41 back in 2002 which reworked
how ON COMMIT works.

Alvaro has mentioned that it would not be needed here:
20181106125337.o23kjdv546bu2tei@alvherre.pgsql
And I think that I agree with that, because visibly this applies to
index rebuilds but in those cases CCIs are happening locally. So I
think that we can get rid of that, and I suggest to remove it only on
HEAD only of course.

Any objections?
--
Michael

Attachments:

oncommit-cci-remove.patchtext/x-diff; charset=us-asciiDownload+1-3
#2Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Michael Paquier (#1)
Re: Removal of unnecessary CommandCounterIncrement() when doing ON COMMIT DELETE ROWS

On 2018-Nov-09, Michael Paquier wrote:

Hi all,

When doing a set of ON COMMIT DELETE ROWS actions for relations, there
is a CCI happening after each truncation:

Right, but note that this is not a loop so it's only one CCI, not one
per relation. (This doesn't seem a big deal either way, but I see no
reason to have that line there.)

And I think that I agree with that, because visibly this applies to
index rebuilds but in those cases CCIs are happening locally. So I
think that we can get rid of that, and I suggest to remove it only on
HEAD only of course.

+1

--
�lvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

#3Michael Paquier
michael@paquier.xyz
In reply to: Alvaro Herrera (#2)
Re: Removal of unnecessary CommandCounterIncrement() when doing ON COMMIT DELETE ROWS

On Mon, Nov 12, 2018 at 01:19:31PM -0300, Alvaro Herrera wrote:

On 2018-Nov-09, Michael Paquier wrote:

When doing a set of ON COMMIT DELETE ROWS actions for relations, there
is a CCI happening after each truncation:

Right, but note that this is not a loop so it's only one CCI, not one
per relation. (This doesn't seem a big deal either way, but I see no
reason to have that line there.)

This looks like a lack of caffeine from my side.

And I think that I agree with that, because visibly this applies to
index rebuilds but in those cases CCIs are happening locally. So I
think that we can get rid of that, and I suggest to remove it only on
HEAD only of course.

+1

Thanks Álvaro for the input, I have committed the change.
--
Michael