X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id BCAF19FB1F4 for ; Tue, 29 Aug 2006 03:35:28 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 54409-09 for ; Tue, 29 Aug 2006 06:35:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.184]) by postgresql.org (Postfix) with ESMTP id 08CE49FB1EE for ; Tue, 29 Aug 2006 03:35:25 -0300 (ADT) Received: by nf-out-0910.google.com with SMTP id m18so27298nfc for ; Mon, 28 Aug 2006 23:35:24 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=JPSiI97QmOUc9T2zx7X0AkFl9MgW8oIK80i+6iGw3Ap6O0DsmUVYifgk7lQ45Loga3v1i8vYe5qLd45ZfeQeRxLm5ZE3DDHXx0M/HAczhN3ruWlj5jdVUKgBs9H19hp6mvO1eOYxEXPCgU55nx5yFoFpK34eb/DY1AUgO/YpXyA= Received: by 10.49.41.18 with SMTP id t18mr609527nfj; Mon, 28 Aug 2006 23:35:23 -0700 (PDT) Received: by 10.48.213.13 with HTTP; Mon, 28 Aug 2006 23:35:23 -0700 (PDT) Message-ID: Date: Tue, 29 Aug 2006 07:35:23 +0100 From: "Peter Childs" To: pgsql-performance@postgresql.org Subject: Re: Identifying bloated tables In-Reply-To: <44F31218.6040703@mall.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <44F30022.1000009@mall.cz> <44F31088.5040602@logix-tt.com> <44F31218.6040703@mall.cz> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.199 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, SPF_PASS X-Spam-Level: X-Archive-Number: 200608/450 X-Sequence-Number: 20635 On 28/08/06, Michal Taborsky - Internet Mall wrote: > Markus Schaber napsal(a): > > Hi, Michal, > > > > Michal Taborsky - Internet Mall wrote: > > > >> When using this view, you are interested in tables, which have the > >> "bloat" column higher that say 2.0 (in freshly dump/restored/analyzed > >> database they should all be around 1.0). > > > > I just noticed some columns in pg_catalog with a bloat value <1 and a > > negative "wasted space" - is this due to the pseudo nature of them? > > It is more likely due to the fact, that these numbers are just > estimates, based on collected table statistics, so for small or > non-standard tables the statistical error is greater that the actual > value. You are usually not interested in tables, which have wasted space > of 1000kB or -1000kB. Also the database must be ANALYZEd properly for > these numbers to carry any significance. > I was just playing around with this table and noticed it preforms the badly in tables with very small record sizes. This seams to be because it ignores the system overhead (oid, xmin ctid etc) which seams to be about 28 bytes per a record this can be quite significate in small record tables and can cause trouble even with a smal numbers of record. Hence I've got a table thats static and fresly "vacuum full" which reads with a bloat of 4. Easy to recreate problem to Create table regionpostcode (area varchar(4), regionid int); then insert 120000 records. Peter.