Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 694161337B82 for ; Sun, 21 Nov 2010 12:25:57 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 06368-01 for ; Sun, 21 Nov 2010 16:25:50 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from spinlock.commandprompt.com (host-215.commandprompt.net [207.173.203.215]) by mail.postgresql.org (Postfix) with ESMTP id D3C101337B7F for ; Sun, 21 Nov 2010 12:25:49 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by spinlock.commandprompt.com (Postfix) with ESMTP id A1EDA348023; Sun, 21 Nov 2010 08:25:42 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at commandprompt.com Received: from spinlock.commandprompt.com ([127.0.0.1]) by localhost (spinlock.commandprompt.com.commandprompt.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9gyk-UUQxCBm; Sun, 21 Nov 2010 08:25:40 -0800 (PST) Received: from perhan.alvh.no-ip.org (unknown [190.95.25.230]) by spinlock.commandprompt.com (Postfix) with ESMTPSA id E8E57348022; Sun, 21 Nov 2010 08:25:39 -0800 (PST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 5C7AB6E4BB; Sun, 21 Nov 2010 13:25:37 -0300 (CLST) Content-Type: text/plain; charset=UTF-8 Cc: pgsql-performance Subject: Re: autovacuum blocks the operations of other manual vacuum From: Alvaro Herrera To: kuopo In-reply-to: References: <1289921093-sup-1911@alvh.no-ip.org> <1290217475-sup-5126@alvh.no-ip.org> Date: Sun, 21 Nov 2010 13:25:37 -0300 Message-Id: <1290356427-sup-9213@alvh.no-ip.org> User-Agent: Sup/git Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201011/339 X-Sequence-Number: 41363 Excerpts from kuopo's message of dom nov 21 11:15:52 -0300 2010: > In my experiment, I need about 1~3 min to finish the analyze operation > on the big table (which depends on the value of vacuum_cost_delay). I > am not surprised because this table is a really big one (now, it has > over 200M records). Okay. You may want to consider lowering the statistics size for all the column in that table; that would reduce analyze time, at the cost of possibly worsening the plans for that table, depending on how irregular the distribution is. See ALTER TABLE / SET STATISTICS in the documentation, and the default_statistics_target parameter in postgresql.conf. > However, the most of my concerns is the behavior of analyze/vacuum. > You mentioned that the analyze-only operation cannot be optimized as > the same way on optimizing vacuum. Does that mean the analyze > operation on a table would unavoidably affect the vacuum proceeded on > another one? That's correct. I think you can run VACUUM ANALYZE, and it would do both things at once; AFAIK this is also optimized like VACUUM is, but I admit I'm not 100% sure (and I can't check right now). > If this is a normal reaction for an analyze operation, > maybe I should try to lower vacuum_cost_delay or use more powerful > hardware to minimize the interfered period. So, the pages for the > small table would not increase quickly. I think it would make sense to have as low a cost_delay as possible for this ANALYZE. (Note you can change it locally with a SET command; no need to touch postgresql.conf. So you can change it when you analyze just this large table). -- Álvaro Herrera The PostgreSQL Company - Command Prompt, Inc. PostgreSQL Replication, Consulting, Custom Development, 24x7 support