X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8D9D447644D for ; Fri, 2 May 2003 18:51:53 -0400 (EDT) Received: from polaris.pinpointresearch.com (66-7-238-176.cust.telepacific.net [66.7.238.176]) by postgresql.org (Postfix) with ESMTP id E456947646E for ; Fri, 2 May 2003 18:51:51 -0400 (EDT) Received: from there (66-7-238-179.cust.telepacific.net [66.7.238.179]) by polaris.pinpointresearch.com (Postfix) with SMTP id 9AC1F103C7; Fri, 2 May 2003 15:51:53 -0700 (PDT) Content-Type: text/plain; charset="iso-8859-1" From: Steve Crawford Organization: Pinpoint Research To: Kyle , Forum - PostGreSQL SQL Subject: Re: Best way to delete time stamped data? Date: Fri, 2 May 2003 14:51:53 -0800 X-Mailer: KMail [version 1.3.1] References: <3EB2EBF0.8010003@ccidomain.com> In-Reply-To: <3EB2EBF0.8010003@ccidomain.com> MIME-Version: 1.0 Message-Id: <20030502225153.9AC1F103C7@polaris.pinpointresearch.com> Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, hits=-32.5 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/39 X-Sequence-Number: 13204 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