EXPIRE as a statement

Поиск
Список
Период
Сортировка
От Blagoj Petrushev
Тема EXPIRE as a statement
Дата
Msg-id CAKe+-77Vu=wzMYSX5d06b2+q6Fi77ZwkO0aYVf8+cewVEca-iQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: EXPIRE as a statement
Re: EXPIRE as a statement
Список 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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Jeff Davis
Дата:
Сообщение: Comment patch for index-only scans
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: EXPIRE as a statement