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 1hEbP8-000162-17 for pgsql-general@arkaria.postgresql.org; Thu, 11 Apr 2019 15:14:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hEbP5-0007GY-L0 for pgsql-general@arkaria.postgresql.org; Thu, 11 Apr 2019 15:14:15 +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 1hEbP5-0007Fj-6u for pgsql-general@lists.postgresql.org; Thu, 11 Apr 2019 15:14:15 +0000 Received: from smtp44.i.mail.ru ([94.100.177.104]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hEbP2-0008BK-GC for pgsql-general@postgresql.org; Thu, 11 Apr 2019 15:14:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject; bh=7wWyWMzKDj+sDyexyTOO7lUoy4Oi58qMjqb3V80oUIA=; b=gumjyoubHSto37h1B/Q4JKa3GrPW6GwSCYmZXzWPazTd4RUuGGO3Q2fI4x4JfNzYFyFo0jTATgFu9U2RJOAXUmDpHO8QNvTp4rkiLzTBaIURA5DmTK2JQeWFzqrdO1x7B+cBjpdnjDiabV2TvSRXHXHDOdo93AAl1iTv3kSnwZk=; Received: by smtp44.i.mail.ru with esmtpa (envelope-from ) id 1hEbOz-0003cv-SF; Thu, 11 Apr 2019 18:14:10 +0300 Subject: Re: When do vacuumed pages/tuples become available for reuse? To: Alvaro Herrera Cc: Tom Lane , pgsql-general General References: <20190411150423.GA7441@alvherre.pgsql> From: rihad Message-ID: <116d6b82-5bfc-ad43-6aab-d165b4b7da85@mail.ru> Date: Thu, 11 Apr 2019 19:14:06 +0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20190411150423.GA7441@alvherre.pgsql> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Authentication-Results: smtp44.i.mail.ru; auth=pass smtp.auth=rihad@mail.ru smtp.mailfrom=rihad@mail.ru X-77F55803: 0014004E1F3277295A78504BD2AC29416CDE1282D82D81962961EC6D8BE2596C046B2E2110F0CF63D5EEC5014C9D7B07 X-7FA49CB5: 0D63561A33F958A5134521A132EBBE836F6F52A9DD5120269058204056848A198941B15DA834481FA18204E546F3947C1D471462564A2E19F6B57BC7E64490618DEB871D839B7333395957E7521B51C2545D4CF71C94A83E9FA2833FD35BB23D27C277FBC8AE2E8B2EE5AD8F952D28FBA471835C12D1D977C4224003CC8364767815B9869FA544D8D32BA5DBAC0009BE9E8FC8737B5C2249AFFDA16987AEDD6B3AA81AA40904B5D9CF19DD082D7633A0BCA8734010DFDAB0D81D268191BDAD3D78DA827A17800CE7542AF255F21831B5CD04E86FAF290E2D26E476CCD9869EB175ECD9A6C639B01B78DA827A17800CE7DC3F68AB1BC71A6DA260FEDC41841B1F75ECD9A6C639B01B4E70A05D1297E1BBC6867C52282FAC8519DC0BE04022C72727F269C8F02392CD5571747095F342E88FB05168BE4CE3AF X-Mailru-Sender: B19AB4DAF1EA2FB518D2771EFF7BC99A5D92E3AB91AB4E2E3C0C29142ED35B5FC6047E2A6533F985108F17C94788D7333DDE9B364B0DF2891F953FB4A677E77772D6B4FCE48DF648AE208404248635DF X-Mras: OK List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 04/11/2019 07:04 PM, Alvaro Herrera wrote: > On 2019-Apr-11, rihad wrote: > >> On 04/11/2019 06:41 PM, Alvaro Herrera wrote: >> >>> Perhaps it'd be better to vacuum this table much more often. >>> >> Each run took 5-6 hours, now it takes 2-3 hours after I've tweaked some >> cost-based vacuum knobs. > But how often does it run? > One after another. Enough n_dead_tuples accumulate in between runs to easily trigger that. autovacuum_vacuum_scale_factor = 0.01 utovacuum_vacuum_threshold = 50 which means to run autovac when 1% of table size + 50 rows have been updated or deleted. But we can't make each autovacuum run run faster ) Currently I lowered this from 20ms: autovacuum_vacuum_cost_delay = 10ms And increased this from 200: autovacuum_vacuum_cost_limit = 400 to make it finish in 1 hour rather than 3 hours. Anything more than that and we risk impacting the performance of user queries.