Is there a way to set an “expiry” time, after which a data entry is automatically deleted in PostgreSQL?

前端 未结 2 1501
北荒
北荒 2020-12-12 12:40

Is there any way to set some sort of \"expiry\" time on data entries in PostgreSQL? I\'m thinking about something equivalent to EXPIRE in Redis.

I\'m not looking to

2条回答
  •  悲哀的现实
    2020-12-12 13:14

    No. There is no such feature.

    I can't see what it does more than either (1) just an "expired" timestamp does or (2) timestamp + cron-job/pgAgent.

    It doesn't sound like a general feature that would be added to the core. You could quite simply code an extension to handle this sort of thing, with either a tick called from a cron-job or perhaps a background-worker process.

    I don't see anything on pgxn, so presumably there's not been much demand for it yet.

提交回复
热议问题