Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 57B14650F09 for ; Tue, 1 Jul 2008 04:57:46 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 71512-02-8 for ; Tue, 1 Jul 2008 04:57:02 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outmail137080.authsmtp.com (outmail137080.authsmtp.com [62.13.137.80]) by postgresql.org (Postfix) with ESMTP id 47B70650F97 for ; Tue, 1 Jul 2008 04:36:48 -0300 (ADT) Received: from mail-c187.authsmtp.com (mail-c187.authsmtp.com [62.13.128.33]) by punt4.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id m617ahph016461; Tue, 1 Jul 2008 08:36:43 +0100 (BST) Received: from [192.168.0.3] (85-211-229-155.dyn.gotadsl.co.uk [85.211.229.155]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id m617aZfe077357; Tue, 1 Jul 2008 08:36:36 +0100 (BST) Subject: Re: VACUUM Improvements - WIP Patch From: Simon Riggs To: Pavan Deolasee Cc: pgsql-patches In-Reply-To: <2e78013d0806092232h6ca15ffejcbcd24e88401308f@mail.gmail.com> References: <2e78013d0806092232h6ca15ffejcbcd24e88401308f@mail.gmail.com> Content-Type: text/plain Date: Tue, 01 Jul 2008 08:41:34 +0100 Message-Id: <1214898094.3845.537.camel@ebony.site> Mime-Version: 1.0 X-Mailer: Evolution 2.12.0 Content-Transfer-Encoding: 7bit X-Server-Quench: 6f569d14-4740-11dd-8155-001185d377ca X-AuthRoute: OCdxZQATClZOTQEd DAteCiNZVAwpPBRK HVkIKg5MJUcNSQVJ NksadBtFaARbZ0xd HGQLW1xEUFV7WmV/ aAwfZQBDYEtPQQdo WVZIR1dNFgBqBAMB SEMYUx4jHVMTeHl3 ZkNlEHJZXUI0cxB4 REcAFGkbYWBkaH0e URQMagtVdQZXfh9E a1h6AHAKZjZWKBg1 TUcABxkNFhVyExEd fCgmEG83CWcOBiQ7 WR0HEDMzBgVADxoS F1QeI0IXHC42 X-Authentic-SMTP: 61633235383639.squirrel.dmpriest.net.uk:1078/Kp X-Report-SPAM: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-Virus-Status: No virus detected - but ensure you scan with your own anti-virus system! X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200807/1 X-Sequence-Number: 6696 On Tue, 2008-06-10 at 11:02 +0530, Pavan Deolasee wrote: > In most of the cases where the old transactions quickly go away, and > for large tables, the second scan will be very limited. In the worst > case, we might incur the overhead of conditional waits without any > success. Looks good. > - An additional boolean pg_class attribute (relvac_inprogress) is used > to track the status of vacuum on a relation. If the attribute is true, > either vacuum is in progress on the relation or the last vacuum did > not complete successfully. > > When VACUUM starts, it sets relvac_inprogress to true. What happens if the last VACUUM crashed? Any negative effects? If so, should autovac be triggered again soon to complete the failed VACUUM? > - We can potentially update FSM at the end of first pass. This is not > a significant issue if the second scan is very limited. But if we do > this, we need to handle the truncate case properly. Not sure why would we do that? What would that give? To do that you'd need to completely redesign FSM since it assumes only one update would take place. > - As the patch stands, we check of old transactions at every block > iteration. This might not be acceptable for the cases where there are > long running transactions. We probably need some exponential gap here. I would make vacuum_delay_point() return bool rather than void, then you can do the check each time we do the delay by saying: if (vacuum_delay_point()) { Need to change VacuumCostActive so it is always active during a VACUUM, so we do accounting even when vacuum wait is zero. -- Simon Riggs www.2ndQuadrant.com PostgreSQL Training, Services and Support