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 1hEaGl-0006QU-6o for pgsql-general@arkaria.postgresql.org; Thu, 11 Apr 2019 14:01:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hEaGj-00043O-Ux for pgsql-general@arkaria.postgresql.org; Thu, 11 Apr 2019 14:01:33 +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 1hEaGj-0003xP-9a for pgsql-general@lists.postgresql.org; Thu, 11 Apr 2019 14:01:33 +0000 Received: from smtp18.mail.ru ([94.100.176.155]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hEaGf-0002jq-Q9 for pgsql-general@postgresql.org; Thu, 11 Apr 2019 14:01:32 +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=eOGAOhuZY5HW9yCBptB35dEHNo4rVNCp9x5lqSG69Z4=; b=Ppnhl1izJTIwdllLhzbdT93RIdzMtNJ0/KJxCVG4QpOcQyYVY9QQy9dQREGt79kH1vtRxWEnosm3lwYzk9fO4uC/WYSuyLFrQ2I7uPYVOzW5wBzixkER5aFUSAd1/qbgXJT6ssHioa2Yyc6Df1XwFOr2+BMNmtJ+qqkteSuZI/k=; Received: by smtp18.mail.ru with esmtpa (envelope-from ) id 1hEaGc-0001jk-6M; Thu, 11 Apr 2019 17:01:26 +0300 Subject: Re: When do vacuumed pages/tuples become available for reuse? To: Tom Lane Cc: pgsql-general General References: <9cd73fcb-511d-ede9-6789-209b7d4eb193@mail.ru> <8560.1554990486@sss.pgh.pa.us> From: rihad Message-ID: <0522481c-4cf6-1928-8780-9bfa2d7c6aca@mail.ru> Date: Thu, 11 Apr 2019 18:01:23 +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: <8560.1554990486@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Authentication-Results: smtp18.mail.ru; auth=pass smtp.auth=rihad@mail.ru smtp.mailfrom=rihad@mail.ru X-77F55803: 3FFC80838138E3AB5A78504BD2AC29416CDE1282D82D81960557A761F966B736C2A930D192B583DF146683E38EE95C3D X-7FA49CB5: 0D63561A33F958A562A84613FDF35E5DA31E9A37646A040E64412DA362A5040D8941B15DA834481FA18204E546F3947CEDCF5861DED71B2F389733CBF5DBD5E9C8A9BA7A39EFB7666BA297DBC24807EA117882F44604297287769387670735209ECD01F8117BC8BEA471835C12D1D977C4224003CC8364767815B9869FA544D8D32BA5DBAC0009BE9E8FC8737B5C2249AFFDA16987AEDD6B3AA81AA40904B5D9CF19DD082D7633A0BCA8734010DFDAB0D81D268191BDAD3D78DA827A17800CE72AC4711D416BF240CD04E86FAF290E2D26E476CCD9869EB175ECD9A6C639B01B78DA827A17800CE72872799650AE99D7F3B6E22150DECFE375ECD9A6C639B01B4E70A05D1297E1BBC6867C52282FAC8519DC0BE04022C72727F269C8F02392CD5571747095F342E88FB05168BE4CE3AF X-Mailru-Sender: B19AB4DAF1EA2FB518D2771EFF7BC99A10D43BC065827B094BCD592C513BE984D80B6FED91AC4744108F17C94788D7333DDE9B364B0DF2891F953FB4A677E77772D6B4FCE48DF648AE208404248635DF X-Mras: OK List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 04/11/2019 05:48 PM, Tom Lane wrote: > rihad writes: >> If an autovacuum job on a huge table runs for 5-6 hours, do its freed >> pages/tuples become available for reuse immediately when they are marked >> as free, or only at the end of the multi-hour vacuum operation? > They'll be freed in batches, where the size of a batch depends on the > autovacuum_work_mem or maintenance_work_mem setting. The basic > work cycle is > > * scan table to find dead tuples, save their TIDs in working memory; > continue until end of table or working memory full > * scan indexes to find index entries matching those TIDs, remove 'em > * go back to table and remove the previously-found tuples > * if not end of table, repeat > > So a larger work-mem setting means fewer passes over the indexes, > but a longer time until space is reclaimed. > > regards, tom lane > . > Thanks! Our autovacuum_work_mem = 1GB, so this probably means any space would be available for reuse only at the end of the vacuum? Are there any downsides in decreasing it to, say, 64MB? I see only pluses )