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 1guYVv-0005R1-1a for pgsql-performance@arkaria.postgresql.org; Fri, 15 Feb 2019 08:06:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1guYVs-0004XY-3J for pgsql-performance@arkaria.postgresql.org; Fri, 15 Feb 2019 08:06:24 +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 1guYVr-0004XR-Ox for pgsql-performance@lists.postgresql.org; Fri, 15 Feb 2019 08:06:23 +0000 Received: from mx2.mailbox.org ([80.241.60.215]) by makus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1guYVo-0001Xt-FP for pgsql-performance@lists.postgresql.org; Fri, 15 Feb 2019 08:06:22 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 586BCA1666; Fri, 15 Feb 2019 09:06:16 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de [80.241.56.117]) (amavisd-new, port 10030) with ESMTP id dkGB6RLePmSG; Fri, 15 Feb 2019 09:06:15 +0100 (CET) Message-ID: <53d097b669514cd2628678149a87f85b7ef3db5f.camel@cybertec.at> Subject: Re: autovacuum big table taking hours and sometimes seconds From: Laurenz Albe To: Mariel Cherkassky , Jeff Janes Cc: David Rowley , pgsql-performance@lists.postgresql.org Date: Fri, 15 Feb 2019 09:06:13 +0100 In-Reply-To: References: <95c2859e3b9b80597a5bf23788b567ac586d068c.camel@cybertec.at> Organization: Cybertec Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Mariel Cherkassky wrote: > Lets focus for example on one of the outputs : > postgresql-Fri.log:2019-02-08 05:05:53 EST 24776 LOG: automatic vacuum of table "myDB.pg_toast.pg_toast_1958391": index scans: 8 > postgresql-Fri.log- pages: 2253 removed, 13737828 remain > postgresql-Fri.log- tuples: 21759258 removed, 27324090 remain > postgresql-Fri.log- buffer usage: 15031267 hits, 21081633 misses, 19274530 dirtied > postgresql-Fri.log- avg read rate: 2.700 MiB/s, avg write rate: 2.469 MiB/s > > The cost_limit is set to 200 (default) and the cost_delay is set to 20ms. > The calculation I did : (1*15031267+10*21081633+20*19274530)/200*20/1000 = 61133.8197 seconds ~ 17H > So autovacuum was laying down for 17h ? I think that I should increase the cost_limit to max specifically on the toasted table. What do you think ? Am I wrong here ? Increasing cost_limit or reducing cost_delay improves the situation. cost_delay = 0 makes autovacuum as fast as possible. Yours, Laurenz Albe