From: | Stephen Frost <sfrost(at)snowman(dot)net> |
---|---|
To: | Blagoj Petrushev <b(dot)petrushev(at)gmail(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: EXPIRE as a statement |
Date: | 2014-05-04 22:15:08 |
Message-ID: | 20140504221508.GM2556@tamriel.snowman.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Blagoj,
* Blagoj Petrushev (b(dot)petrushev(at)gmail(dot)com) wrote:
> The rows that match the `my_condition` will be deleted when the
> current timestamp reaches my_timestamp or, in the second case, exactly
> my_interval time after the execution.
An in-PG version of cron has been discussed before and seems like it
would meet your need here. It's certainly something which I would like
to see happen, most likely using the background worker infrastructure.
I don't know of anyone actively working on it though.
Your proposal does have the interesting property that it could be
implemented without a cron-like process by keeping track of the
expiration time and then just ignoring the records even if they're
there. That could be done with a view, of course, but as you point out,
it'd need backend/core support if it's going to work for FK
relationships or similar.
> As a consequence, a row function ttl(), i.e. time-to-live, would be
> appropriate (not quite clear about this, though). Basically, would
> return an interval until the deletion of the row takes place, or none
> if the there's no expiration scheduled.
For a view-based approcah, this function could be trivially written to
go against the underlying table to return the answer.
Thanks,
Stephen
From | Date | Subject | |
---|---|---|---|
Next Message | Neil Tiffin | 2014-05-04 22:15:11 | Re: pgaudit - an auditing extension for PostgreSQL |
Previous Message | Blagoj Petrushev | 2014-05-04 21:38:04 | EXPIRE as a statement |