X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 2AF6411F6C47 for ; Mon, 3 Apr 2006 15:39:14 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59219-02 for ; Mon, 3 Apr 2006 15:39:12 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id A683311F6C35 for ; Mon, 3 Apr 2006 15:39:11 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k33IdA8L015522; Mon, 3 Apr 2006 14:39:10 -0400 (EDT) To: Kenji Morishige cc: pgsql-performance@postgresql.org Subject: Re: optimizing db for small table with tons of updates In-reply-to: <20060403182403.GA12257@juniper.net> References: <20060403182403.GA12257@juniper.net> Comments: In-reply-to Kenji Morishige message dated "Mon, 03 Apr 2006 11:24:03 -0700" Date: Mon, 03 Apr 2006 14:39:10 -0400 Message-ID: <15521.1144089550@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.114 required=5 tests=[AWL=0.114] X-Spam-Score: 0.114 X-Spam-Level: X-Archive-Number: 200604/27 X-Sequence-Number: 18111 Kenji Morishige writes: > Various users run a tool that updates this table to determine if the particular > resource is available or not. Within a course of a few days, this table can > be updated up to 200,000 times. There are only about 3500 records in this > table, but the update and select queries against this table start to slow > down considerablly after a few days. Ideally, this table doesn't even need > to be stored and written to the filesystem. After I run a vacuum against this > table, the overall database performance seems to rise again. You should never have let such a table go that long without vacuuming. You might consider using autovac to take care of it for you. If you don't want to use autovac, set up a cron job that will vacuum the table at least once per every few thousand updates. regards, tom lane