Actually, I'd recommend
DELETE FROM generators WHERE started <= now() - '30 minutes'::interval;
This might or might not seem more natural than the other way, but it
has the advantage that there's at least a potential to make use of an
index on the "started" column. In practice, because now() is
Quoting Mitch Vincent ([EMAIL PROTECTED]):
> An alternative, though I'm not sure it's better in any way :
>
> DELETE FROM generators WHERE started + '30 minutes'::interval <= now();
Well, that looks a little nicer. Thanks.
--
Paul Tomblin <[EMAIL PROTECTED]>, not speaking for anybody
Q: How
July 08, 2001 2:12 PM
Subject: [GENERAL] How should I phrase this?
> I've got a table that I insert a value and a timestamp "now()". Then I
> want to delete entries that are older than 30 minutes old. After some
> experimentation, I found the following works, but it lo
I've got a table that I insert a value and a timestamp "now()". Then I
want to delete entries that are older than 30 minutes old. After some
experimentation, I found the following works, but it looks awkward and
backwards. Is there a better, more readable way of phrasing this or
rewriting it?