From: Jean-Luc Lachance <jllachan@nsd.ca>
To: jim@nasby.net
Cc: Kyle <kyle@ccidomain.com>
Cc: Forum - PostGreSQL General <pgsql-general@postgresql.org>
Subject: Re: [SQL] Best way to delete time stamped data?
Date: Sun, 04 May 2003 13:12:19 -0400
Message-ID: <3EB549F3.C7532C26@nsd.ca> (raw)
References: <3EB2EBF0.8010003@ccidomain.com>
<200305021619.41879.josh@agliodbs.com>
<3EB510F1.8090708@ccidomain.com>
<20030504113029.W66185@flake.decibel.org>
The index can be used with a little rewrite (assuming trxdate is
indexed):
DELETE FROM ONLY richtable WHERE trxdate < current_timestamp - '90
days'::interval;
"Jim C. Nasby" wrote:
>
> On Sun, May 04, 2003 at 09:09:05AM -0400, Kyle wrote:
> > Josh,
> >
> > Thanks, even my boss can read the new statement:
> >
> > DELETE FROM ONLY richtable WHERE age(trxdate) > '90 days';
>
> Just remember that that query won't use any index on trxdate, because
> it has to calculate 'age(trxdate)' for every value in the table.
> --
> Jim C. Nasby (aka Decibel!) jim@nasby.net
> Member: Triangle Fraternity, Sports Car Club of America
> Give your computer some brain candy! www.distributed.net Team #1828
>
> Windows: "Where do you want to go today?"
> Linux: "Where do you want to go tomorrow?"
> FreeBSD: "Are you guys coming, or what?"
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
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: jllachan@nsd.ca, jim@nasby.net, kyle@ccidomain.com, pgsql-general@postgresql.org
Subject: Re: [SQL] Best way to delete time stamped data?
In-Reply-To: <3EB549F3.C7532C26@nsd.ca>
* 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