Skip to content

Latest commit

 

History

History
99 lines (23 loc) · 3.88 KB

20200324_15.md

File metadata and controls

99 lines (23 loc) · 3.88 KB

PostgreSQL period record插件 - 记录的超期设定 , 自动清理记录 , 自动过期 , 生命周期 , 类似redis

作者

digoal

日期

2020-03-24

标签

PostgreSQL , 有效时间 , 超期自动删除 , period


背景

类似一些KV存储的功能, 记录有它的生命周期 , 自动删除超期记录

Temporal Tables PostgreSQL Extension

https://github.com/arkhipov/temporal_tables

A temporal table is a table that records the period of time when a row is valid. There are two types of periods: the application period (also known as valid-time or business-time) and the system period (also known as transaction-time).

The system period is a column (or a pair of columns) with a system-maintained value that contains the period of time when a row is valid from a database perspective. When you insert a row into such table, the system automatically generates the values for the start and end of the period. When you update or delete a row from a system-period temporal table, the old row is archived into another table, which is called the history table.

The application period is a column (or a pair of columns) with an application-maintained value that contains the period of time when a row is valid from an application perspective. This column is populated by an application.

Note that these two time periods do not have to be the same for a single fact. For example, you may have a temporal table storing data about historical or even future facts. The application period of these facts differs from the system period which is set when we add or modify the facts into the table.

Currently, Temporal Tables Extension supports the system-period temporal tables only.

您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.

digoal's wechat