From: Andreas Kostyrka <andreas@kostyrka.org>
To: Orhan Aglagul <oaglagul@cittio.com>
Cc: pgsql-performance@postgresql.org
Cc: pgsql-performance@postgresql.org
Subject: Re: Drop table vs Delete record
Date: Tue, 22 May 2007 20:48:39 +0200
Message-ID: <XLkxYBG6LNVC.tmK1fdGC@heaven.kostyrka.org> (raw)
Consider table partitioning (it's described in the manual).
Andreas
-- Ursprüngl. Mitteil. --
Betreff: [PERFORM] Drop table vs Delete record
Von: "Orhan Aglagul" <oaglagul@cittio.com>
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).
(I know I could run vacuum analyze)
Thanks,
Orhan A.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: andreas@kostyrka.org, oaglagul@cittio.com
Subject: Re: Drop table vs Delete record
In-Reply-To: <XLkxYBG6LNVC.tmK1fdGC@heaven.kostyrka.org>
References: <XLkxYBG6LNVC.tmK1fdGC@heaven.kostyrka.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox