Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 46F14B5DBBF for ; Wed, 25 May 2011 20:11:44 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 78219-10 for ; Wed, 25 May 2011 23:11:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-fx0-f46.google.com (mail-fx0-f46.google.com [209.85.161.46]) by mail.postgresql.org (Postfix) with ESMTP id D1111B5D95B for ; Wed, 25 May 2011 20:11:31 -0300 (ADT) Received: by fxm17 with SMTP id 17so245627fxm.19 for ; Wed, 25 May 2011 16:11:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=VOeVvU05qvPvBwxoBLiPZdKYqenWGEhBrZemD494qUY=; b=vAHBHTvg2AxM0yOmkn7BcPIr8Lq4Xh7wvUjoMtC39YIYvoisaUo9ztsqPBhuI4h+3v 7iFtAi2YZ6AJr6WrCBsqyC7i8kAELpJkTvMow9RGl9WfNEq26mnGBygK12aqUZQab5bm NBbRiBNtQlAYuPqvPPbJu1I2TQJWYfkS2FKV0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=F1QQVX7hCxSHJ/zwgChWSteGADGWc1oPN0cYJepbWWrDEkYcUL3tWt0SqVy6baIymg CncaMI+g+vZwqkSSxUdqngnw5n3QQrnmgiwIFyzc8MMGgLh19IHbhjwT+NkoCzkhzzW2 KKckk1A8WlIbKYjtkToGO2Orb2Ui8q3y/dDHA= MIME-Version: 1.0 Received: by 10.204.84.5 with SMTP id h5mr49288bkl.201.1306365091378; Wed, 25 May 2011 16:11:31 -0700 (PDT) Received: by 10.204.39.10 with HTTP; Wed, 25 May 2011 16:11:31 -0700 (PDT) In-Reply-To: <28141.1306360470@sss.pgh.pa.us> 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> <28141.1306360470@sss.pgh.pa.us> Date: Wed, 25 May 2011 19:11:31 -0400 Message-ID: Subject: Re: [ADMIN] pg_class reltuples/relpages not updated by autovacuum/vacuum From: Robert Haas To: Tom Lane Cc: Florian Helmberger , pgsql-hackers@postgresql.org, Alvaro Herrera Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.898 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RFC_ABUSE_POST=0.001 X-Spam-Level: X-Archive-Number: 201105/1325 X-Sequence-Number: 188359 On Wed, May 25, 2011 at 5:54 PM, Tom Lane wrote: > Robert Haas writes: >> On Wed, May 25, 2011 at 1:04 PM, Tom Lane wrote: >>> Because the problem is not specific to TOAST tables. =A0As things >>> currently stand, we will accept the word of an ANALYZE as gospel even i= f >>> it scanned 1% of the table, and completely ignore the results from a >>> VACUUM even if it scanned 99% of the table. =A0This is not sane. > >> I agree that if VACUUM scanned 99% of the table, it's probably fine to >> use its numbers. =A0It's also fine to use the numbers from ANALYZE, >> because those pages are chosen randomly. =A0What 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. =A0The fact that ANALYZE looked at a > random subset of pages is *no guarantee whatsoever* that its results are > highly accurate. =A0They might be more trustworthy than VACUUM's nonrando= m > 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. I think you're arguing against a straw-man. > 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. Can we simply use a constant for tuple density 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. http://dilbert.com/strips/comic/2008-05-07/ --=20 Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company