Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h1uO9-000210-Cg for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Mar 2019 14:52:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h1uO7-0007Gr-SB for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Mar 2019 14:52:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h1uO7-0007GH-Kx for pgsql-hackers@lists.postgresql.org; Thu, 07 Mar 2019 14:52:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h1uO5-0000eG-Ee for pgsql-hackers@lists.postgresql.org; Thu, 07 Mar 2019 14:52:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x27EqUMK008901; Thu, 7 Mar 2019 09:52:30 -0500 From: Tom Lane To: Robert Haas cc: Tomas Vondra , Kyotaro HORIGUCHI , Andres Freund , "Tsunakawa, Takayuki" , Alvaro Herrera , Bruce Momjian , "Ideriha, Takeshi" , PostgreSQL Hackers , Michael Paquier , David Steele , Craig Ringer Subject: Re: Protect syscache from bloating with negative cache entries In-reply-to: References: <20190225.152653.211323929.horiguchi.kyotaro@lab.ntt.co.jp> <20190301.173245.25820912.horiguchi.kyotaro@lab.ntt.co.jp> <1752.1551903431@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Thu, 07 Mar 2019 09:34:24 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <8899.1551970350.1@sss.pgh.pa.us> Date: Thu, 07 Mar 2019 09:52:30 -0500 Message-ID: <8900.1551970350@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Robert Haas writes: > On Wed, Mar 6, 2019 at 6:18 PM Tomas Vondra > wrote: >> Which part of the LRU approach is supposedly expensive? Updating the >> lastaccess field or moving the entries to tail? I'd guess it's the >> latter, so perhaps we can keep some sort of age field, update it less >> frequently (once per minute?), and do the clock sweep? > Move to tail (although lastaccess would be expensive if too if it > involves an extra gettimeofday() call). As I recall, the big problem with the old LRU code was loss of locality of access, in that in addition to the data associated with hot syscache entries, you were necessarily also touching list link fields associated with not-hot entries. That's bad for the CPU cache. A gettimeofday call (or any other kernel call) per syscache access would be a complete disaster. regards, tom lane