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

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl

Reply via email to