pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix O(N^2) stat() calls when recycling WAL segments
Date: Fri, 15 Jan 2021 01:33:46 +0000
Message-ID: <E1l0Dzm-0002la-S7@gemulon.postgresql.org> (raw)

Fix O(N^2) stat() calls when recycling WAL segments

The counter tracking the last segment number recycled was getting
initialized when recycling one single segment, while it should be used
across a full cycle of segments recycled to prevent useless checks
related to entries already recycled.

This performance issue has been introduced by b2a5545, and it was first
implemented in 61b86142.

No backpatch is done per the lack of field complaints.

Reported-by: Andres Freund, Thomas Munro
Author: Michael Paquier
Reviewed-By: Andres Freund
Discussion: https://postgr.es/m/20170621211016.eln6cxxp3jrv7m4m@alap3.anarazel.de
Discussion: https://postgr.es/m/CA+hUKG+DRiF9z1_MU4fWq+RfJMxP7zjoptfcmuCFPeO4JM2iVg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5ae1572993ae8bf1f6c33a933915c07cc9bc0add

Modified Files
--------------
src/backend/access/transam/xlog.c | 61 ++++++++++++++++++++-------------------
1 file changed, 31 insertions(+), 30 deletions(-)



Message-ID: <E1l0Dzm-0002la-S7@gemulon.postgresql.org>
Permalink:  ../E1l0Dzm-0002la-S7@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1l0Dzm-0002la-S7@gemulon.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz
  Subject: Re: pgsql: Fix O(N^2) stat() calls when recycling WAL segments
  In-Reply-To: <E1l0Dzm-0002la-S7@gemulon.postgresql.org>
  References: <E1l0Dzm-0002la-S7@gemulon.postgresql.org>

* 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