Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 61763B5DBE0 for ; Wed, 25 May 2011 18:54:40 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 09549-06 for ; Wed, 25 May 2011 21:54:33 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 23398B5D95B for ; Wed, 25 May 2011 18:54:32 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p4PLsUSj028142; Wed, 25 May 2011 17:54:30 -0400 (EDT) To: Robert Haas cc: Florian Helmberger , pgsql-hackers@postgresql.org, Alvaro Herrera Subject: Re: [ADMIN] pg_class reltuples/relpages not updated by autovacuum/vacuum In-reply-to: References: <4DD28F73.6010108@25th-floor.com> <25017.1306291669@sss.pgh.pa.us> <4DDCA801.70805@25th-floor.com> <19738.1306338472@sss.pgh.pa.us> <22497.1306341699@sss.pgh.pa.us> <22926.1306343067@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Wed, 25 May 2011 13:15:59 -0400" Date: Wed, 25 May 2011 17:54:30 -0400 Message-ID: <28141.1306360470@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201105/1322 X-Sequence-Number: 188356 Robert Haas writes: > On Wed, May 25, 2011 at 1:04 PM, Tom Lane wrote: >> Because the problem is not specific to TOAST tables.  As things >> currently stand, we will accept the word of an ANALYZE as gospel even if >> it scanned 1% of the table, and completely ignore the results from a >> VACUUM even if it scanned 99% of the table.  This is not sane. > I agree that if VACUUM scanned 99% of the table, it's probably fine to > use its numbers. It's also fine to use the numbers from ANALYZE, > because those pages are chosen randomly. What bothers me is the idea > of using a small *non-random* sample, and I'm not sure that > incorporating possibly-bogus results slowly is any better than > incorporating them quickly. The above is simply fuzzy thinking. The fact that ANALYZE looked at a random subset of pages is *no guarantee whatsoever* that its results are highly accurate. They might be more trustworthy than VACUUM's nonrandom sample of a similar number of pages, but it doesn't hold even a little bit of water to claim that we should believe ANALYZE completely and VACUUM not at all even when the latter has looked at a significantly larger sample of pages. In any case, your line of thought doesn't help us for fixing the problem with toast tables, because we aren't going to start doing ANALYZEs on toast tables. The bottom line here is that making use of stats we have is a lot better than not making use of them, even if they aren't entirely trustworthy. regards, tom lane