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 1hFOfy-0003Ow-VT for pgsql-hackers@arkaria.postgresql.org; Sat, 13 Apr 2019 19:50:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hFOfx-0000mr-D0 for pgsql-hackers@arkaria.postgresql.org; Sat, 13 Apr 2019 19:50:57 +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 1hFOfw-0000mk-T4 for pgsql-hackers@lists.postgresql.org; Sat, 13 Apr 2019 19:50:57 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hFOfs-0006ED-ON for pgsql-hackers@lists.postgresql.org; Sat, 13 Apr 2019 19:50:55 +0000 Received: by mail-wm1-x341.google.com with SMTP id z6so2966817wmi.0 for ; Sat, 13 Apr 2019 12:50:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=86pd6SAZMQRhKLRlNwll2PRzwSogJUqOmrV+27o805M=; b=hLZVVlslkXL9O7g/Yi3bkQJL7HHEa91nCPnPo+HUqP+Bti66bNLglBd3WdbN5betbY 8KbJ0UeMVBAcMbIq6KehpOVw+YwS45J6nixNuPXyCjbkSaArBdm/nrb4RVJtLfkGnVz5 0mKxB/rrfkKXQfF67ZN5XadjkxQs5EDN6dwx4cAsCTnMOEOv850tiRS57p6wzVYFiBrl SclHlcaVGF3pYGDyuhZ8JTr4RGd41SE4L3B2ulrcdnHvceKJPZsUezWK4MaviILDWzXS OXb6WYLrT93dJE0A4s0kqG5T/+4OFKIll4L4GOcktyVXnZmVEc8ZdKEXYkXPSp2ORb4H kJPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=86pd6SAZMQRhKLRlNwll2PRzwSogJUqOmrV+27o805M=; b=DH2EZSi9Qk/xydOYCK80Tzz1YHBsjWP3tpsomM5wTXmHCiigknlilQxltRJL+vXgs/ DblGkX4+FX/MEiNhTR8MbVng/3jsjLgsZhlh7DJCUZxj9b/I+r3/OSE6KyWj5/JiD1wg dqXc9L/STz1oB6EQtrKN0Fg31v/jAZ4DXebOUJ5LSqINJ5CMl/FFkkhG5xfJQm72i7ux f40G2XS8pspUHVhEIf53BVIMvfChNHIZxOJyQLQJ1drJ3T7i7BvE41wHtO+sGs7aSlVd nNRABTgr7LB459GQasNUSvrXZGZpqTF0vGYmOV4AmvVjhi8Mch9Ko6yjoWC6RRqtPFYy Bzbw== X-Gm-Message-State: APjAAAVA10ZRVNX4EfPVHC8sFodCvfN9RMDh2WgXnV6143QngEzsln1g BcR9mt4bQw+vJ5wAHzUzthj1MA== X-Google-Smtp-Source: APXvYqxdb6HyIraIiPhDMeW2IMwDMC+rbHTWCkRpJ2Jh4PsoupOF53T+Gkb/UNFn4cxxdy/+r8XGHg== X-Received: by 2002:a1c:ac07:: with SMTP id v7mr16874982wme.49.1555185049897; Sat, 13 Apr 2019 12:50:49 -0700 (PDT) Received: from localhost (ip-86-49-243-43.net.upcbroadband.cz. [86.49.243.43]) by smtp.gmail.com with ESMTPSA id w9sm18718427wmi.0.2019.04.13.12.50.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 13 Apr 2019 12:50:48 -0700 (PDT) Date: Sat, 13 Apr 2019 21:50:48 +0200 From: Tomas Vondra To: Chris Travers Cc: Andres Freund , Alvaro Herrera , Darafei =?utf-8?Q?Kom=D1=8Fpa?= Praliaskouski , Michael Banck , David Rowley , PostgreSQL Developers Subject: Re: Berserk Autovacuum (let's save next Mandrill) Message-ID: <20190413195048.nfuysawke5xytcdg@development> References: <20190410151306.GA26795@alvherre.pgsql> <0495B833-B614-4170-9B67-EA88489E18EE@anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180716-1444-295967 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Apr 11, 2019 at 11:25:29AM +0200, Chris Travers wrote: > On Wed, Apr 10, 2019 at 5:21 PM Andres Freund wrote: > > Hi, > > On April 10, 2019 8:13:06 AM PDT, Alvaro Herrera > wrote: > >On 2019-Mar-31, Darafei "Komяpa" Praliaskouski wrote: > > > >> Alternative point of "if your database is super large and actively > >written, > >> you may want to set autovacuum_freeze_max_age to even smaller values > >so > >> that autovacuum load is more evenly spread over time" may be needed. > > > >I don't think it's helpful to force emergency vacuuming more > >frequently; > >quite the contrary, it's likely to cause even more issues.  We should > >tweak autovacuum to perform freezing more preemtively instead. > > I still think the fundamental issue with making vacuum less painful is > that the all indexes have to be read entirely. Even if there's not much > work (say millions of rows frozen, hundreds removed). Without that issue > we could vacuum much more frequently. And do it properly in insert only > workloads. > > So I see a couple of issues here and wondering what the best approach is. > The first is to just skip lazy_cleanup_index if no rows were removed.  Is > this the approach you have in mind?  Or is that insufficient? I don't think that's what Andres had in mind, as he explicitly mentioned removed rows. So just skipping lazy_cleanup_index when there were no deleted would not help in that case. What I think we could do is simply leave the tuple pointers in the table (and indexes) when there are only very few of them, and only do the expensive table/index cleanup once there's anough of them. > The second approach would be to replace the whole idea of this patch with > a lazy freeze worker which would basically periodically do a vacuum freeze > on relations matching certain criteria.  This could have a lower max > workers than autovacuum and therefore less of a threat in terms of total > IO usage. > Thoughts? > Not sure. I find it rather difficult to manage more and more different types of cleanup workers. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services