Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nvPyO-0001lk-4m for pgsql-hackers@arkaria.postgresql.org; Sun, 29 May 2022 20:57:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nvPyN-0004Gk-02 for pgsql-hackers@arkaria.postgresql.org; Sun, 29 May 2022 20:57:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nvPyL-0004Ga-Ug for pgsql-hackers@lists.postgresql.org; Sun, 29 May 2022 20:57:14 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nvPyI-0005ly-TP for pgsql-hackers@postgresql.org; Sun, 29 May 2022 20:57:13 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 931875C00D5; Sun, 29 May 2022 16:57:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Sun, 29 May 2022 16:57:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1653857829; x=1653944229; bh=yaRQNa4LrP YiKvT4gJKvDSFuHKg0qEb2bXTojak6EKg=; b=BXzoH1ge+RkY3GNuIJ09cmRszr lvOVHpNxPxrmZNv/hjLLVOw2qvXHNlmBGGIIzhfA+YqUXbMgtRSfvUosgvKH4VM+ 2P2t0v9haoMGpSBWSvxqygV8o5LLOmAXSqxA3qOkXotZwPlMH0dKjAg95TAsEpYf qZt15et3tM/NpEV4idTZe06y/SIFQnmRNxVunZXq+IxRRoecHePsS4abXWeIgcGU WSosNC7Zbw78D6kha/+mwkloZ0d4ke5ZKgxpC8lnysYpnxsvRkpunCns9Bh9jn9e 4coBSSFlbixolaSXCMiTrP57AgDmOGsxTJF7NVYzUDxEXdMNyCxM7uAUbQ3g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1653857829; x=1653944229; bh=yaRQNa4LrPYiKvT4gJKvDSFuHKg0 qEb2bXTojak6EKg=; b=AFrX+LzAX3OEowzeUL+2xX22nT0/UiLobUAgmvE9lrNp kLTwd3NlE4sEyqYFxreA6RIwDcSWfqvqBVdKkEQAVUKGlHjg7YX13x7rC5XlHQYf Y4P0Dtbw70UItgdmPg1lwrjF9vzQYIjslYLgvOCgUKO8PBm9gkMhEtN6iF2S6cgC kL8IHVS1HLVmmIFKiUac83B3z4Cd65MLRXeLMi2XVS3MqqAvleEDbWfkfngS3tKM rSOKbPm41qZXDQQdTp3ZZTb029qljxiBrOGGE1aYyBRt1i4AqpwsJvox6OS89ugm 15nOQusKVFy/8Loc8rAvu78m32bwKnpAgGHvVUf1gw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrkeeggdduheegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughr vghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrf grthhtvghrnhepvdfffeevhfetveffgeeiteefhfdtvdffjeevhfeuteegleduheetvedu ieettddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 29 May 2022 16:57:08 -0400 (EDT) Date: Sun, 29 May 2022 13:57:07 -0700 From: Andres Freund To: Thomas Munro Cc: Heikki Linnakangas , pgsql-hackers Subject: Re: SLRUs in the main buffer pool, redux Message-ID: <20220529205707.jfmnp4fgjtpx32bw@alap3.anarazel.de> References: <5ced6199-9fa2-722c-2163-4418ca907a95@iki.fi> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2022-05-28 13:13:20 +1200, Thomas Munro wrote: > There was a little bit of discussion on #pgcon-stream2 which I could > summarise as: can we figure out a way to keep parts of the CLOG pinned > so that backends don't have to do that for each lookup? Then CLOG > checks become simple reads. Included in that is not needing to re-check that the identity of the buffer changed since the last use and to not need a PrivateRefCountEntry. Neither is cheap... I'd structure it so that there's a small list of slru buffers that's pinned in a "shared" mode. Entering the buffer into that increases the BufferDesc's refcount, but is *not* memorialized in the backend's refcount structures, because it's "owned by the SLRU". > There may be some relation to the idea of > 'nailing' btree root pages that I've heard of from a couple of people > now (with ProcSignalBarrier or something more fine grained along those > lines if you need to unnail anything). Something to think about. I'm very doubtful it's a good idea to combine those things - I think it's quite different to come up with a design for SLRUs, of which there's a constant number and shared memory ownership datastructures, and btree root pages etc, of which there are arbitrary many. For the nbtree (and similar) cases, I think it'd make sense to give backends a size-limited number of pages they can keep pinned, but in a backend local way. With, as you suggest, a procsignal barrier or such to force release. > I'm also wondering if it would be possible to do "optimistic" pinning > instead for reads that normally need only a pin, using some kind of > counter scheme with read barriers to tell you if the page might have > been evicted after you read the data... -many That seems fragile and complicated, without, at least to me, a clear need. Greetings, Andres Freund