作者
digoal
日期
2020-10-10
标签
PostgreSQL , System Versioned Temporal Table
背景
Why temporal
Real data sources are dynamic and more often than not business decisions rely on insights that analysts can get from data evolution. Use cases for temporal tables include:
- Auditing all data changes and performing data forensics when necessary
- Reconstructing state of the data as of any time in the past
- Calculating trends over time
- Maintaining a slowly changing dimension for decision support applications
- Recovering from accidental data changes and application errors
可以跟踪记录的变更历史, 查询表在过去的任何时刻的snapshot.
不过flashback query也可以cover这个需求. 在拥有System Versioned Temporal Table功能之前, 使用hstore+trigger也能实现这个需求.
《PostgreSQL 闪回 - flash back query emulate by trigger》
参考
https://docs.microsoft.com/en-us/sql/relational-databases/tables/temporal-tables?view=sql-server-ver15
https://github.com/xocolatl/periods/
https://www.postgresql.org/message-id/flat/CALAY4q-cXCD0r4OybD=w7Hr7F026ZUY6=LMsVPUe6yw_PJpTKQ@mail.gmail.com
PostgreSQL 许愿链接
您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.
9.9元购买3个月阿里云RDS PostgreSQL实例
PostgreSQL 解决方案集合
德哥 / digoal's github - 公益是一辈子的事.





