X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C05F552AF1 for ; Tue, 2 Aug 2005 21:25:55 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55407-02 for ; Wed, 3 Aug 2005 00:25:46 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6F8EF528EE for ; Tue, 2 Aug 2005 21:25:44 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id EEC943095A; Wed, 3 Aug 2005 02:34:19 +0200 (MET DST) From: "Jeff Eckermann" X-Newsgroups: pgsql.interfaces Subject: Re: about postgres performance issue Date: Wed, 3 Aug 2005 09:55:40 +0930 Organization: Hub.Org Networking Services Lines: 68 Message-ID: References: <20050728151813.46697.qmail@web53507.mail.yahoo.com> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original To: pgsql-interfaces@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=3.363 tagged_above=0 required=5 tests=AWL, FORGED_YAHOO_RCVD, PRIORITY_NO_NAME X-Spam-Level: *** X-Archive-Number: 200508/2 X-Sequence-Number: 5673 "jing han" wrote in message news:20050728151813.46697.qmail@web53507.mail.yahoo.com... > Hello, > > We have a database with around 20000 records. Most of > the time we need to update records in two tables. > These two tables have around 6000 records. When we > update them, records in one of the table just get > updated, some of the records in another table will be > deleted and new records will be added. > > When we repeatedly update these two tables, (note: we > execute "vacuum --analyze" every time after we update > those two tables). we check our log file, the first > time took 8 seconds, the second time took 9 seconds, > the third time took 11 seconds, the fourth time took > 15 seconds, the fifth time took 18 seconds, the sixth > time took 22 seconds and so on. The time we use to > update two tables increses. > > We check the database file directory, found database > file size growed. > > Then we use "vacuum full", or use a script to do > su -l postgres -c "pg_dump -Fc -f bigNetManDB netman; > sleep 2; pg_restore -v --clean -d netman > bigNetManDB" > > to try to bring down the database size. > > We still found that after we "vacuum full" database, > the first time to update those two tables took 10 > seconds, seconds time took 13 seconds and so on, which > means we cannot get 8 seconds performance anymore. > > Can you give me any idea to deal with the database > size growing problem? What version of PostgreSQL are you running? If it is any version later than 7.2.x (and it certainly ought to be), then you should be able to solve your problem with appropriate Free Space Map (FSM) settings, in combination with sufficiently frequent vacuuming. What is "appropriate" and "sufficient" in your case depends on your local conditions. Have a look at the manual for more information, and try reading the archives of the pgsql-performance list for relevant discussions. > > Any help will be greatly appreciated. > > > jing > > > > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org >