X-Original-To: pgsql-performance@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id F304D475C15 for ; Wed, 30 Apr 2003 20:10:40 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 3D519475B85 for ; Wed, 30 Apr 2003 20:10:40 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h410AcU6025283; Wed, 30 Apr 2003 20:10:38 -0400 (EDT) To: "Ron Mayer" Cc: josh@agliodbs.com, "Achilleus Mantzios" , pgsql-performance@postgresql.org Subject: Re: [SQL] 7.3 analyze & vacuum analyze problem In-reply-to: References: Comments: In-reply-to "Ron Mayer" message dated "Wed, 30 Apr 2003 15:16:58 -0700" Date: Wed, 30 Apr 2003 20:10:38 -0400 Message-ID: <25282.1051747838@sss.pgh.pa.us> From: Tom Lane X-Spam-Status: No, hits=-32.5 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/272 X-Sequence-Number: 1778 "Ron Mayer" writes: > Short summary: Later in the thread Tom explained my problem as free > space not being evenly distributed across the table so ANALYZE's > sampling gave skewed results. In my case, "pgstatuple" was a > good tool for diagnosing the problem, "vacuum full" fixed my table > and a much larger fsm_* would have probably prevented it. Not sure if that is Achilleus' problem or not. IIRC, there should be no difference at all in what VACUUM ANALYZE and ANALYZE put into pg_statistic (modulo random sampling variations of course). The only difference is that VACUUM ANALYZE puts an exact tuple count into pg_class.reltuples (since the VACUUM part groveled over every tuple, this info is available) whereas ANALYZE does not scan the entire table and so has to put an estimate into pg_class.reltuples. It would be interesting to see the pg_class and pg_stats rows for this table after VACUUM ANALYZE and after ANALYZE --- but I suspect the main difference will be the reltuples values. regards, tom lane