Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D44FF477719 for ; Fri, 4 Oct 2002 10:44:41 -0400 (EDT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id 0AE754772EF for ; Fri, 4 Oct 2002 10:33:47 -0400 (EDT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id g94EZJ910514 for ; Fri, 4 Oct 2002 20:05:19 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id g94EZJv10509 for ; Fri, 4 Oct 2002 20:05:19 +0530 From: "Shridhar Daithankar" To: pgsql-general@postgresql.org Date: Fri, 04 Oct 2002 20:04:20 +0530 MIME-Version: 1.0 Subject: Re: Fast Deletion For Large Tables Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3D9DF444.8941.11B2104@localhost> In-reply-to: <3D9B38F7.12A7AEA3@noaa.gov> X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/234 X-Sequence-Number: 31232 On 2 Oct 2002 at 14:20, Raymond Chui wrote: > Everything is running fine, except take long time to finish. > Because some tables stored values from 50,000 to 100,000 rows > Some deletion need to deleted up to 45,000 rows. That's not much. How much time it exactly takes? Does it have index on timestamp field? > > So I am thinking just delete the rows by their row number or row ID, > like > > DELETE FROM a_table WHERE row_id < 45000; I don't think that's the problem. Do you have big enough WAL's for deleting 45000 records in one transaction? Try deleting them in batches or increase WAL files and buffers..Should help you.. > I know there is row_id in Oracle. > Is there row_id for a table in Postgres? That's called as OIDs in postgresql. But as I said, it's likely that you might not have sufficient;y big WAL. Try setting some higher values.. Or don't delete in transactions if possible.. Bye Shridhar -- Consent decree: A document in which a hapless company consents never to commit in the future whatever heinous violations of Federal law it never admitted to in the first place.