From: Raymond Chui <raymond.chui@noaa.gov>
To: pgsql-admin@postgresql.org
To: pgadmin-support@postgresql.org
To: pgsql-general@postgresql.org
Subject: Fast Deletion For Large Tables
Date: Wed, 02 Oct 2002 14:20:39 -0400
Message-ID: <3D9B38F7.12A7AEA3@noaa.gov> (raw)
I have some tables with huge data.
The tables have column timestamp and float.
I am try to keep up to 6 day of data values.
What I do is execute SQL below from crontab (UNIX to
schedule commands).
BEGIN;
DELETE FROM table_1 WHERE column_time < ('now'::timestamp - '6
days'::interval);
.....
DELETE FROM table_n WHERE column_time < ('now'::timestamp - '6
days'::interval);
COMMIT;
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.
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 know there is row_id in Oracle.
Is there row_id for a table in Postgres?
Thank Q!
Attachments:raymond.chui.vcf (text/x-vcard, 311B) download
begin:vcard
n:Chui;Raymond
tel;work:301-713-0640 x168
x-mozilla-html:FALSE
url:http://www.nws.noaa.gov/
org:NWS, NOAA;OHD13
version:2.1
email;internet:raymond.chui@noaa.gov
title:CS
adr;quoted-printable:;;1325 East-West Highway=0D=0ASSMC2, Room 8112;Silver Spring;MD;20910-3282;U.S.A.
fn:Raymond Chui
end:vcard
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-admin@postgresql.org
Cc: raymond.chui@noaa.gov, pgadmin-support@postgresql.org, pgsql-general@postgresql.org
Subject: Re: Fast Deletion For Large Tables
In-Reply-To: <3D9B38F7.12A7AEA3@noaa.gov>
References: <3D9B38F7.12A7AEA3@noaa.gov>
* 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