Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 61EC32E0063 for ; Thu, 17 Apr 2008 05:52:51 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 95647-08 for ; Thu, 17 Apr 2008 05:52:37 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from ptb-relay01.plus.net (ptb-relay01.plus.net [212.159.14.212]) by developer.postgresql.org (Postfix) with ESMTP id 7AC652E0043 for ; Thu, 17 Apr 2008 05:52:37 -0300 (ADT) Received: from [84.51.143.99] (helo=server3.office.archonet.com) by ptb-relay01.plus.net with esmtp (Exim) id 1JmPr5-0000zD-Kw; Thu, 17 Apr 2008 09:52:31 +0100 Received: from [192.168.1.36] (dell36.office.archonet.com [192.168.1.36]) by server3.office.archonet.com (Postfix) with ESMTP id 7B28827405F; Thu, 17 Apr 2008 09:52:31 +0100 (BST) Message-ID: <48070FCF.7070102@archonet.com> Date: Thu, 17 Apr 2008 09:52:31 +0100 From: Richard Huxton User-Agent: Thunderbird 2.0.0.12 (X11/20080213) MIME-Version: 1.0 To: Adrian Moisey CC: Bill Moran , pgsql-performance@postgresql.org Subject: Re: db size References: <4802F9E4.3000704@careerjunction.co.za> <48032237.4040604@careerjunction.co.za> <4803276C.2090901@careerjunction.co.za> <48045A32.3010607@careerjunction.co.za> <20080415071222.36b2e8eb.wmoran@collaborativefusion.com> <4806EE1A.8010400@careerjunction.co.za> <48070708.4060605@archonet.com> <48070DC3.1040709@careerjunction.co.za> In-Reply-To: <48070DC3.1040709@careerjunction.co.za> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Plusnet-Relay: 3268fb696b5f1727a90e13fbf910c4d3 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200804/229 X-Sequence-Number: 29722 Adrian Moisey wrote: > Hi > >>> INFO: "blahxxx": scanned 27 of 27 pages, containing 1272 live rows >>> and 0 dead rows; 1272 rows in sample, 1272 estimated total rows >> >> This is a small table that takes up 27 pages and it scanned all of >> them. You have 1272 rows in it and none of them are dead (i.e. >> deleted/updated but still taking up space). > > I had a look through a few other tables...: > > INFO: "table1": scanned 22988 of 22988 pages, containing 2713446 live > rows and 895662 dead rows; 45000 rows in sample, 2713446 estimate > d total rows > > INFO: "table2": scanned 24600 of 24600 pages, containing 270585 live > rows and 65524 dead rows; 45000 rows in sample, 270585 estimated total rows > > Is that dead rows an issue? Should I try clean it out? Will it improve > performance ? What you're hoping to see is that figure remain stable. The point of the free-space-map is to track these and allow the space to be re-used. If you find that the number of dead rows is increasing then either you are: 1. Just deleting rows 2. Not vacuuming enough - check your autovacuum settings The effect on performance is that when you read in a page from disk you're reading dead rows along with the data you are after. Trying to keep 0 dead rows in a constantly updated table isn't worth the effort though - you'd end up wasting your disk I/O on maintenance rather than queries. The figures above look high to me - 90,000 out of 270,000 and 65,000 out of 270,000. Of course, if these tables have just had bulk updates/deletes then that's fine. If there's a steady stream of updates though, you probably want to up your autovacuum settings. -- Richard Huxton Archonet Ltd