From: Steve Crawford <scrawford@pinpointresearch.com>
To: Kyle <kyle@ccidomain.com>
To: Forum - PostGreSQL SQL <pgsql-sql@postgresql.org>
Subject: Re: Best way to delete time stamped data?
Date: Fri, 2 May 2003 14:51:53 -0800
Message-ID: <20030502225153.9AC1F103C7@polaris.pinpointresearch.com> (raw)
In-Reply-To: <3EB2EBF0.8010003@ccidomain.com>
References: <3EB2EBF0.8010003@ccidomain.com>
I'm usually lazy and let automatic casting work for me:
DELETE FROM ONLY richtable WHERE now()-trxdate > '90 days';
Cheers,
Steve
On Friday 02 May 2003 3:06 pm, Kyle wrote:
> Hello. I have a table that contains time stamped data. To delete rows
> that are over 90 days old, I do this:
>
>
> DELETE FROM ONLY richtable WHERE trxdate < current_timestamp - interval
> '90 days';
>
>
> This works great. But I was wondering if there is a better or more
> compact way to go about it. (this method feels "clunky" to me)
>
> Thanks.
>
> -Kyle
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: scrawford@pinpointresearch.com, kyle@ccidomain.com
Subject: Re: Best way to delete time stamped data?
In-Reply-To: <20030502225153.9AC1F103C7@polaris.pinpointresearch.com>
* 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