From: | Blagoj Petrushev <b(dot)petrushev(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | EXPIRE as a statement |
Date: | 2014-05-04 21:38:04 |
Message-ID: | CAKe+-77Vu=wzMYSX5d06b2+q6Fi77ZwkO0aYVf8+cewVEca-iQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello,
This is my first time posting on the list. Also, I was trying to find
something on the list's history on this topic but without results.
My idea is new statement with roughly the following format (similar to update):
EXPIRE FROM my_table
AT my_timestamp
WHERE my_condition
or
EXPIRE FROM my_table
AFTER my_interval
WHERE my_condition
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.
One concern would of course be the FK integrity, but the regular
DELETE takes into account the RESTRICT / SET NULL / SET DEFAULT /
CASCADE specification on the FK, so this statement would take those
into account as well.
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.
I know for example that redis has this feature, the EXPIRE / EXPIREAT
/ TTL commands.
http://redis.io/commands/expire
Kind regards,
Blagoj Petrushev
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2014-05-04 22:15:08 | Re: EXPIRE as a statement |
Previous Message | Jeff Davis | 2014-05-04 20:50:08 | Comment patch for index-only scans |