Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 076599FBBE1 for ; Wed, 23 May 2007 17:24:39 -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 12875-01 for ; Wed, 23 May 2007 17:24:27 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from smtp2.hushmail.com (smtp2.hushmail.com [65.39.178.134]) by postgresql.org (Postfix) with ESMTP id A146C9FB6FE for ; Wed, 23 May 2007 17:24:29 -0300 (ADT) Received: from smtp2.hushmail.com (localhost [127.0.0.1]) by smtp2.hushmail.com (Postfix) with SMTP id 77A2617030 for ; Wed, 23 May 2007 20:24:27 +0000 (UTC) Message-ID: <4654A2F7.5000409@1006.org> Date: Wed, 23 May 2007 22:24:23 +0200 From: Chris Mair MIME-Version: 1.0 To: oaglagul@cittio.com CC: pgsql-performance@postgresql.org Subject: Re: Drop table vs Delete record Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/468 X-Sequence-Number: 24858 Hi, with that setup you should vacuum aggressivley. I'd send a vacuum statement in a third thread every 15 minutes or so. The table renaming trick doesn't sound very handy or even necessary... Bye, Chris. > Date: Tue, 22 May 2007 14:38:40 -0400 > From: "Orhan Aglagul" > To: > Subject: Drop table vs Delete record > Message-ID: <868BCE5A6576F44A862F1FBBC3E14A0103A595AB@ms17.mse9.exchange.ms> > > > My application has two threads, one inserts thousands of records per second into a table (t1) and the other thread > periodically deletes expired records (also in thousands) from the same table (expired ones). So, we have one thread > adding a row while the other thread is trying to delete a row. In a short time the overall performance of any sql > statements on that instance degrades. (ex. Select count(*) from t1 takes more then few seconds with less than 10K > rows). > > My question is: Would any sql statement perform better if I would rename the table to t1_%indx periodically, create a > new table t1 (for new inserts) and just drop the tables with expired records rather then doing a delete record? (t1 is > a simple table with many rows and no constraints). > > (I know I could run vacuum analyze) > > Thanks, > > Orhan A.