Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 88C769FB505 for ; Wed, 20 Jun 2007 16:52:21 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 09781-03 for ; Wed, 20 Jun 2007 16:52:14 -0300 (ADT) X-Greylist: delayed 00:26:33.363761 by SQLgrey-1.7.5 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 4C6009FB7ED for ; Wed, 20 Jun 2007 16:52:17 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from turing.leapfrogonline.com (Leapfrog-Online-1143628.cust-rtr.ameritech.net [70.230.73.42]) by svr4.postgresql.org (Postfix) with ESMTP id 958995AF896 for ; Wed, 20 Jun 2007 19:25:43 +0000 (GMT) Received: by turing.leapfrogonline.com (Postfix, from userid 1000) id 6E6B38A2AA; Wed, 20 Jun 2007 14:25:29 -0500 (CDT) From: Shaun Thomas Organization: Leapfrog Online To: pgsql-performance@postgresql.org Subject: Re: Performance query about large tables, lots of concurrent access Date: Wed, 20 Jun 2007 14:25:28 -0500 User-Agent: KMail/1.9.6 References: <4676DD57.7070304@metacarta.com> <20070620175300.GN30369@alvh.no-ip.org> <46796A08.8080601@metacarta.com> In-Reply-To: <46796A08.8080601@metacarta.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200706201425.28557.sthomas@leapfrogonline.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.136 tagged_above=0 required=5 tests=BAYES_50=0.001, FORGED_RCVD_HELO=0.135 X-Spam-Level: X-Archive-Number: 200706/447 X-Sequence-Number: 25480 On Wednesday 20 June 2007 12:55:20 pm Karl Wright wrote: > I am afraid that I did answer this. My largest tables > are the ones continually being updated. The smaller > ones are updated only infrequently. You know, it actually sounds like you're getting whacked by the same problem that got us a while back. It sounds like you weren't vacuuming frequently enough initially, and then tried vacuuming later, only after you noticed performance degrade. Unfortunately what that means, is for several weeks or months, Postgres has not been reusing rows on your (admittedly) active and large tables; it just appends at the end, and lets old rows slowly bloat that table larger and larger. Indexes too, will suffer from dead pages. As frightening/sickening as this sounds, you may need to dump/restore the really huge table, or vacuum-full to put it on a crash diet, and then maintain a strict daily or bi-daily vacuum schedule to keep it under control. The reason I think this: even with several 200M row tables, vacuums shouldn't take over 24 hours. Ever. Do a vacuum verbose and see just how many pages it's trying to reclaim. I'm willing to wager it's several orders of magnitude higher than the max_fsm_pages setting you've stuck in your config file. You'll also want to see which rows in your 250M+ table are actually active, and shunt the stable rows to another (warehouse) table maybe available only via view or table partition. I mean, your most active table is also the largest? Seems a bit backward, to me. -- Shaun Thomas Database Administrator Leapfrog Online 807 Greenwood Street Evanston, IL 60201 Tel. 847-440-8253 Fax. 847-570-5750 www.leapfrogonline.com