X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5F289D1B488 for ; Fri, 4 Jun 2004 17:57:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 27190-09 for ; Fri, 4 Jun 2004 20:57:08 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 3029ED1B1E3 for ; Fri, 4 Jun 2004 17:57:05 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i54Kv61S010493; Fri, 4 Jun 2004 16:57:06 -0400 (EDT) To: Joseph Shraibman Cc: Greg Stark , pgsql-general@postgresql.org Subject: Re: VACUUM Question In-reply-to: <40C0C475.8070609@selectacast.net> References: <40345D0D.9060103@meerkatsoft.com> <87smdb1k0d.fsf@stark.xeocode.com> <40C0C475.8070609@selectacast.net> Comments: In-reply-to Joseph Shraibman message dated "Fri, 04 Jun 2004 14:50:29 -0400" Date: Fri, 04 Jun 2004 16:57:05 -0400 Message-ID: <10492.1086382625@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/195 X-Sequence-Number: 61578 Joseph Shraibman writes: > Greg Stark wrote: >> There won't be anything to VACUUM after the insert, but perhaps you still want >> to run ANALYZE. Note that a plain ANALYZE uses a statistical sample which is >> much faster, whereas VACUUM ANALYZE has to look at every record anyways so >> it's slower but produces more accurate statistics. If you don't have > That is not true. My nightly vacuum analyze clearly is sampling: > INFO: "tablename": 22102 pages, 30000 rows sampled, 1712934 estimated > total rows There is (only) one aspect in which VACUUM ANALYZE will produce more accurate stats than a standalone ANALYZE: what it stores into pg_class.reltuples is the true total tuple count produced by the VACUUM phase, rather than the estimate produced by the ANALYZE phase. What goes into pg_statistic will be the same in both cases, however, and will be based on a sample not the whole table. BTW, a VACUUM just after a table is loaded by INSERT/COPY is not necessarily useless. It won't reclaim space, there being none to reclaim, but it will mark all the rows as "known committed", thereby saving some amount of I/O that would otherwise be incurred by later transactions. regards, tom lane