X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C604E476373 for ; Mon, 5 May 2003 05:56:19 -0400 (EDT) Received: from rtlocal.trade-india.com (unknown [203.196.129.235]) by postgresql.org (Postfix) with SMTP id 294D647637F for ; Mon, 5 May 2003 05:56:14 -0400 (EDT) Received: (qmail 17029 invoked from network); 5 May 2003 09:57:32 -0000 Received: from unknown (HELO system67.trade-india-local.com) (unknown) by unknown with SMTP; 5 May 2003 09:57:32 -0000 From: Rajesh Kumar Mallah Organization: Infocom Network Limited To: josh@agliodbs.com, Kyle , Forum - PostGreSQL SQL Subject: Re: Best way to delete time stamped data? Date: Mon, 5 May 2003 15:26:21 +0530 User-Agent: KMail/1.5 References: <3EB2EBF0.8010003@ccidomain.com> <200305021619.41879.josh@agliodbs.com> In-Reply-To: <200305021619.41879.josh@agliodbs.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200305051526.21885.mallah@trade-india.com> X-Spam-Status: No, hits=-33.1 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES,SIGNATURE_SHORT_SPARSE, USER_AGENT 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/48 X-Sequence-Number: 13213 an index on age(date(trxdate)) would make it faster ? regds mallah. On Saturday 03 May 2003 4:49 am, Josh Berkus wrote: > Kyle, > > > 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) > > More compact than that ?!?!?! > Maybe you should go into Perl, instead of SQL -- I think the one-liners > would suit you. > > You can use the age() function, but all that funciton does is the same > calculation you have above. -- Rajesh Kumar Mallah, Project Manager (Development) Infocom Network Limited, New Delhi phone: +91(11)6152172 (221) (L) ,9811255597 (M) Visit http://www.trade-india.com , India's Leading B2B eMarketplace.