Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id DA8DD9FB72B for ; Tue, 22 May 2007 15:50:10 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 08692-04 for ; Tue, 22 May 2007 15:50:00 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from heaven.kostyrka.org (h1634.serverkompetenz.net [81.169.154.44]) by postgresql.org (Postfix) with ESMTP id 239F19FB6BE for ; Tue, 22 May 2007 15:50:02 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by heaven.kostyrka.org (Postfix) with ESMTP id C11394FB8C; Tue, 22 May 2007 20:49:59 +0200 (CEST) Received: from heaven.kostyrka.org ([127.0.0.1]) by localhost (heaven.kostyrka.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 06086-07; Tue, 22 May 2007 20:49:59 +0200 (CEST) Received: from [81.3.240.3] (081-003-240-003.dyn.one.at [81.3.240.3]) by heaven.kostyrka.org (Postfix) with ESMTP id 2389D4FB86; Tue, 22 May 2007 20:49:57 +0200 (CEST) From: "Andreas Kostyrka" Reply-To: "Andreas Kostyrka" To: "Orhan Aglagul" Cc: Subject: Re: Drop table vs Delete record Date: Tue, 22 May 2007 20:48:39 +0200 Message-ID: X-Mailer: EPOC Email Version 2.10 MIME-Version: 1.0 Content-Language: i-default Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/442 X-Sequence-Number: 24832 Consider table partitioning (it's described in the manual). Andreas -- Urspr=C3=BCngl. Mitteil. -- Betreff: [PERFORM] Drop table vs Delete record Von: "Orhan Aglagul" Datum: 22.05.2007 18:42 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).=20 (I know I could run vacuum analyze)=20 Thanks, Orhan A. =20