Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id D454D9FBFF9 for ; Tue, 23 Oct 2007 13:11:57 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 82595-04 for ; Tue, 23 Oct 2007 13:11:53 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id E9FC39FBFA3 for ; Tue, 23 Oct 2007 13:11:52 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id l9NGBpr4019339; Tue, 23 Oct 2007 12:11:51 -0400 (EDT) To: Ron St-Pierre cc: pgsql-performance@postgresql.org Subject: Re: 12 hour table vacuums In-reply-to: <471E18ED.3090704@shaw.ca> References: <471E18ED.3090704@shaw.ca> Comments: In-reply-to Ron St-Pierre message dated "Tue, 23 Oct 2007 08:53:17 -0700" Date: Tue, 23 Oct 2007 12:11:51 -0400 Message-ID: <19338.1193155911@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/253 X-Sequence-Number: 27275 Ron St-Pierre writes: > The table has 140,000 rows, 130 columns (mostly NUMERIC), 60 indexes. It > is probably our 'key' table in the database and gets called by almost > every query (usually joined to others). The table gets updated only > about 10 times a day. We were running autovacuum but it interfered with > the updates to we shut it off. 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. Here is your problem: > vacuum_cost_delay = 200 If you are only vacuuming when nothing else is happening, you shouldn't be using vacuum_cost_delay at all: set it to 0. In any case this value is probably much too high. I would imagine that if you watch the machine while the vacuum is running you'll find both CPU and I/O load near zero ... which is nice, unless you would like the vacuum to finish sooner. In unrelated comments: > maintenance_work_mem = 786432 That seems awfully high, too. > max_fsm_pages = 70000 And this possibly too low --- are you sure you are not leaking disk space? > stats_start_collector = off > stats_command_string = on > stats_block_level = on > stats_row_level = on These are not self-consistent. regards, tom lane