Setup TTL for Aurora Postgres Table

0

Hi,

In a Aurora PostgreSQL table, we would like to setup TTL (Time-to-live) kind of thing, where rows will expire or will be deleted automatically after few hours/days. What is the best way to do this?

Thanks, Satya

1개 답변
3

Postgres does not have any out of the box solution to define TTL for a table. The recommended approach would be to convert the table as range partitioned table based of day/hour and schedule a purge script to drop the older partitions.. Here's a blog to convert a table into partitioned table : https://aws.amazon.com/blogs/database/partition-existing-tables-using-native-commands-in-amazon-rds-for-postgresql-and-amazon-aurora-postgresql/.

pg_partman extension can be used to create/maintain partitions as documented here : https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL_Partitions.html

AWS
답변함 5달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인