X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id CE1EAD1B554 for ; Fri, 3 Oct 2003 23:22:23 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 71521-01 for ; Fri, 3 Oct 2003 20:21:36 -0300 (ADT) Received: from wight.ymogen.net (unknown [217.27.240.153]) by svr1.postgresql.org (Postfix) with SMTP id 849F4D1B4FB for ; Fri, 3 Oct 2003 20:21:32 -0300 (ADT) Received: (qmail 25824 invoked from network); 3 Oct 2003 23:21:35 -0000 Received: from dsl-217-155-239-51.zen.co.uk (HELO finisterre) (217.155.239.51) by wight.ymogen.net with SMTP; 3 Oct 2003 23:21:35 -0000 From: "Matt Clark" To: "Rob Nagler" , Subject: Re: reindex/vacuum locking/performance? Date: Sat, 4 Oct 2003 00:21:32 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-Reply-To: <16253.61013.56254.526139@jump.bivio.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/120 X-Sequence-Number: 3868 > > vacuum full does require exclusive lock, plain vacuum does not. > > I think I need full, because there are updates on the table. As I > understand it, an update in pg is an insert/delete, so it needs > to be garbage collected. Yes and no. You only need a plain VACUUM that is run often enough to recover space as fast as you need to grab it. For heavily updated tables run it often - I run it every 5 minutes on some tables. A VACUUM FULL is only needed if you haven't been running VACUUM often enough in the first place. > The description of vacuum full implies that is required if the db > is updated frequently. This db gets about 1 txn a second, possibly > more at peak load. Assuming you mean 1 update/insert per second that is an absolutely _trivial_ load on any reasonable hardware. You can do thousands of updates/second on hardware costing less than $2000. If you vacuum every hour then you will be fine. > IOW, vacuum+reindex is faster than dump+restore? I didn't see this, > then again, I had this locking problem, so the stats are distorted. REINDEX also locks tables like VACUUM FULL. Either is terribly slow, but unless you turn off fsync during the restore it's unlikely to be slower than dump & restore. Matt