Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 16B3B9FB858 for ; Tue, 23 Oct 2007 13:38:37 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 49432-02 for ; Tue, 23 Oct 2007 13:38:22 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from oxford.xeocode.com (unknown [62.232.55.118]) by postgresql.org (Postfix) with ESMTP id 875589FB38A for ; Tue, 23 Oct 2007 13:38:31 -0300 (ADT) Received: from localhost ([127.0.0.1] helo=oxford.xeocode.com) by oxford.xeocode.com with esmtp (Exim 4.67) (envelope-from ) id 1IkMlx-00028Q-F0; Tue, 23 Oct 2007 17:38:29 +0100 To: "Ron St-Pierre" Cc: Subject: Re: 12 hour table vacuums In-Reply-To: <471E18ED.3090704@shaw.ca> (Ron St-Pierre's message of "Tue\, 23 Oct 2007 08\:53\:17 -0700") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) X-Draft-From: ("nnimap+mail01.enterprisedb.com:INBOX.performance" 2916) References: <471E18ED.3090704@shaw.ca> From: Gregory Stark Organization: EnterpriseDB Date: Tue, 23 Oct 2007 17:38:29 +0100 Message-ID: <87y7dtokfu.fsf@oxford.xeocode.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/257 X-Sequence-Number: 27279 "Ron St-Pierre" writes: > We vacuum only a few of our tables nightly, this one is the last one because it > takes longer to run. I'll probably re-index it soon, but I would appreciate any > advice on how to speed up the vacuum process (and the db in general). ... > vacuum_cost_delay = 200 Well speeding up vacuum isn't really useful in itself. In fact you have vacuum configured to run quite slowly by having vacuum_cost_delay set so high. You have it set to sleep 200ms every few pages. If you lower that it'll run faster but take more bandwidth away from the foreground tasks. > Here's the table information: > The table has 140,000 rows, 130 columns (mostly NUMERIC), 60 indexes. For what it's worth NUMERIC columns take more space than you might expect. Figure a minimum of 12 bytes your rows are at about 1.5k each even if the non-numeric columns aren't large themselves. What are the other columns? > We were running autovacuum but it interfered with the updates to we shut it > off. Was it just the I/O bandwidth? I'm surprised as your vacuum_cost_delay is quite high. Manual vacuum doesn't do anything differently from autovacuum, neither should interfere directly with updates except by taking away I/O bandwidth. > We vacuum this table nightly, and it currently takes about 12 hours to > vacuum it. Not much else is running during this period, nothing that should > affect the table. Is this time increasing over time? If once a day isn't enough then you may be accumulating more and more dead space over time. In which case you may be better off running it during prime time with a large vacuum_cost_delay (like the 200 you have configured) rather than trying to get to run fast enough to fit in the off-peak period. > deadlock_timeout = 10000 I would not suggest having this quite this high. Raising it from the default is fine but having a value larger than your patience is likely to give you the false impression that something is hung if you should ever get a deadlock. -- Gregory Stark EnterpriseDB http://www.enterprisedb.com