Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 20D4E6500B4 for ; Wed, 30 Jul 2008 18:59:02 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 77271-10 for ; Wed, 30 Jul 2008 18:58:55 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by postgresql.org (Postfix) with ESMTP id D010764FFE4 for ; Wed, 30 Jul 2008 18:58:58 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KOJh8-0005fR-55 for pgsql-performance@postgresql.org; Wed, 30 Jul 2008 21:58:54 +0000 Received: from apn-77-113-78-203.gprs.plus.pl ([77.113.78.203]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 30 Jul 2008 21:58:54 +0000 Received: from public by apn-77-113-78-203.gprs.plus.pl with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 30 Jul 2008 21:58:54 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-performance@postgresql.org From: Miernik Subject: Re: Database size Vs performance degradation Date: Wed, 30 Jul 2008 23:58:34 +0200 Lines: 19 Message-ID: <20080730215834.5323.0.NOFFLE@turbacz.local> References: <35FABCF85D99464FB00BC5123DC2A70A051D0FB8@s228130hz1ew09.apptix-01.savvis.net> <276541.4189.qm@web25805.mail.ukl.yahoo.com> Reply-To: Miernik X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: apn-77-113-78-203.gprs.plus.pl X-Archive: encrypt=none User-Agent: tin/1.9.3-20080506 ("Dalintober") (UNIX) (Linux/2.6.25-2-686 (i686)) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200807/258 X-Sequence-Number: 30858 Valentin Bogdanov wrote: > I am guessing that you are using DELETE to remove the 75,000 > unimportant. Change your batch job to CREATE a new table consisting > only of the 5,000 important. You can use "CREATE TABLE table_name AS > select_statement" command. Then drop the old table. After that you can > use ALTER TABLE to change the name of the new table to that of the old > one. I have a similar, but different situation, where I TRUNCATE a table with 60k rows every hour, and refill it with new rows. Would it be better (concerning bloat) to just DROP the table every hour, and recreate it, then to TRUNCATE it? Or does TRUNCATE take care of the boat as good as a DROP and CREATE? I am running 8.3.3 in a 48 MB RAM Xen, so performance matters much. -- Miernik http://miernik.name/