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 1gufzB-0007RN-6v for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Feb 2019 16:05:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gufz9-0006nt-Sl for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Feb 2019 16:05:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gufz9-0006nm-I6 for pgsql-hackers@lists.postgresql.org; Fri, 15 Feb 2019 16:05:07 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gufz6-00045Q-Je for pgsql-hackers@lists.postgresql.org; Fri, 15 Feb 2019 16:05:06 +0000 Received: by mail-wm1-x32a.google.com with SMTP id t15so2050273wmi.5 for ; Fri, 15 Feb 2019 08:05:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=IFBjGRjc2XznmG54lYItCqjDidzxY4kvT6pILrtiWvc=; b=hfCGSeX1ND5TtDp9QEiBITYHA5iDPt10ln60U193Dq2ccXh3xzE58FXeZFXuOzOHbq p6L7Ish6SbkDHIfm2ZVhdZJfMP6XMP+mN/kmal0c6P6Iwb+BKkrmMYgHU0QqCLLYqehJ uBa4uEdis2vprX4LFl/0l+vPymT+Lnx45lrAXDoqUOYeoRTfQXeR/9x07YgNrfUumUz3 LUqMyG76h6jkemHDscr/NoFJUTVlNF5e18T2biNIKKWsDVgtrxCpr21OElOu5oVigkh4 7ema8tVxHXX5efw7+JBAx/izsh7k5qK7G4fIvmwoSyoE38ERSJWU254ogglt/JYShAh+ 3f5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=IFBjGRjc2XznmG54lYItCqjDidzxY4kvT6pILrtiWvc=; b=V5Dqw5s1Aaga37Pw4r48DEQcheQaOAeWbCdqbRkH/nf2MWBl2Q2aqfLl8gCZgod0aW LV3ru5Yf6KiO1XUVGredj0DCO5IBZrkvy/kGaINpsLAuiZCAl0GKHe66D/PafoqVkmfg ZC5waN9Ujahp2K1FUqIsphCRB01mn7f+s23MgC0TRmqzvkag8ZV/eY/qzQ5T+ISJQoCj sj6b3hjaGc5QFoUYQBcBEVfmJ7YQ/ay9XuIfCBtUkqHn8ClQ1mKDGBP8K2p4ybRr2QEx +6f3TjR16xKGfbhwliNF/cnz/0WRduwEhWPoiJRDSWpAaAvHdpUB8CfqDEz11V+K6Jlm jvqQ== X-Gm-Message-State: AHQUAubBJsmgsDxXZ7RIL7PWiEtsZ0z8chN4Y4+azdu5848rk8socP/9 xawAIwAqm6dFDCV6hQYAYb+5fw== X-Google-Smtp-Source: AHgI3IZkC6xvGcDj/7E+Yu2bNfS2jcZ23WU3mf1KdQBr4Dye7madDmMHMdKywmES/nnIpTWRseMl4A== X-Received: by 2002:a1c:96c5:: with SMTP id y188mr7208728wmd.103.1550246703102; Fri, 15 Feb 2019 08:05:03 -0800 (PST) Received: from [10.137.0.17] (ip-86-49-246-90.net.upcbroadband.cz. [86.49.246.90]) by smtp.gmail.com with ESMTPSA id s4sm3127027wmc.21.2019.02.15.08.05.01 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Fri, 15 Feb 2019 08:05:01 -0800 (PST) Subject: Re: Protect syscache from bloating with negative cache entries To: 'Bruce Momjian' , "Tsunakawa, Takayuki" Cc: "andres@anarazel.de" , Robert Haas , Tom Lane , Kyotaro HORIGUCHI , "Ideriha, Takeshi" , "pgsql-hackers@lists.postgresql.org" , "alvherre@alvh.no-ip.org" , "michael.paquier@gmail.com" , "david@pgmasters.net" , "craig@2ndquadrant.com" References: <20190119010941.6ruftewah7t3k3yk@alap3.anarazel.de> <20190121205624.GB1060@momjian.us> <0d3806bf-5087-a75f-3592-ee1d508a79db@2ndquadrant.com> <883b2580-027e-4cb4-fb21-679c14fdb50a@2ndquadrant.com> <0A3221C70F24FB45833433255569204D1FB9723F@G01JPEXMBYT05> <9ebe0ac4-b59e-6397-0586-4e7125de7d5b@2ndquadrant.com> <20190213202402.GA6933@momjian.us> <0A3221C70F24FB45833433255569204D1FB98603@G01JPEXMBYT05> <20190214154955.GB19578@momjian.us> From: Tomas Vondra Message-ID: <95bd95f4-761c-78fd-e8eb-ca56b5f94c1f@2ndquadrant.com> Date: Fri, 15 Feb 2019 17:05:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190214154955.GB19578@momjian.us> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2/14/19 4:49 PM, 'Bruce Momjian' wrote: > On Thu, Feb 14, 2019 at 01:31:49AM +0000, Tsunakawa, Takayuki wrote: >> From: Bruce Momjian [mailto:bruce@momjian.us] >>>> That being said, having a "minimal size" threshold before starting >>>> with the time-based eviction may be a good idea. >>> >>> Agreed. I see the minimal size as a way to keep the systems tables >>> in cache, which we know we will need for the next query. >> >> Isn't it the maximum size, not minimal size? Maximum size allows >> to keep desired amount of system tables in memory as well as to >> control memory consumption to avoid out-of-memory errors (OS crash!). >> I'm wondering why people want to take a different approach to >> catcatch, which is unlike other PostgreSQL memory e.g. shared_buffers, >> temp_buffers, SLRU buffers, work_mem, and other DBMSs. > > Well, that is an _excellent_ question, and one I had to think about. > I think we're talking about two different concepts here: 1) minimal size - We don't do any extra eviction at all, until we reach this cache size. So we don't get any extra overhead from it. If a system does not have issues. 2) maximal size - We ensure the cache size is below this threshold. If there's more data, we evict enough entries to get below it. My proposal is essentially to do just (1), so the cache can grow very large if needed but then it shrinks again after a while. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services