Re: Speedup of relation deletes during recovery

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: Speedup of relation deletes during recovery
Date: 2018-06-27 00:16:39
Message-ID: CAEepm=1+P+9YvU3FULUSzjRa-ZSKKDBgggKTOTQt88GC6F7oWg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jun 22, 2018 at 5:41 AM, Andres Freund <andres(at)anarazel(dot)de> wrote:
> On 2018-06-21 14:40:58 +0900, Michael Paquier wrote:
>> On Wed, Jun 20, 2018 at 08:43:11PM -0700, Andres Freund wrote:
>> > On 2018-06-18 11:13:47 -0700, Andres Freund wrote:
>> >> We could do that - but add_to_unowned_list() is actually a bottleneck in
>> >> other places during recovery too. We pretty much never (outside of
>> >> dropping relations / databases) close opened relations during recovery -
>> >> which is obviously problematic since nearly all of the entries are
>> >> unowned. I've come to the conclusion that we should have a global
>> >> variable that just disables adding anything to the global lists.
>> >
>> > On second thought: I think we should your approach in the back branches,
>> > and something like I'm suggesting in master once open.

I think we should take the hint in the comments and make it O(1)
anyway. See attached draft patch.

+ SMgrRelation *srels = NULL;

There seems to be no reason to initialise the variable to NULL in the
three places where you do that. It is always assigned a value before
use.

There is probably a way to share a bit more code among those three
places, but that sort of refactoring should be for later.

--
Thomas Munro
http://www.enterprisedb.com

Attachment Content-Type Size
0001-Use-a-doubly-linked-list-for-unowned-relations.patch application/octet-stream 3.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2018-06-27 01:13:21 Re: Speedup of relation deletes during recovery
Previous Message David G. Johnston 2018-06-26 22:04:18 Re: Name of main process differs between servers (postmaster vs postgres)