Re: How should I phrase this? - Mailing list pgsql-general

From Tom Lane
Subject Re: How should I phrase this?
Date
Msg-id 7018.994625706@sss.pgh.pa.us
Whole thread Raw
In response to Re: How should I phrase this?  (Paul Tomblin <ptomblin@xcski.com>)
List pgsql-general
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 considered
a non-constant-foldable function by the optimizer, you have to cheat a
little bit to make the righthand side reduce to a constant so that
indexing will actually work.  See past discussions in the archives.

            regards, tom lane

pgsql-general by date:

Previous
From: "Brent R. Matzelle"
Date:
Subject: Re: Bad news for Open Source databases, acording to survey
Next
From: missive@frontiernet.net (Lee Harr)
Date:
Subject: Re: Postgres and C/C++