Replies: 1 comment 12 replies
-
As long as you're on PG version 12 or higher, you can have a quite a high number of partitions (several 1000) without noticing much of an issue. If you want to try and keep the partition count lower, I'd say do monthly but instead of a 30 day/1 month retention do 60 days/2months. Unless there's some business requirement that no data older than 30 days can exist, there's no harm in keeping one extra partition around to ensure you keep your minimum data amount. If you must purge older data, then you'd have to go with the daily option. |
Beta Was this translation helpful? Give feedback.
12 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
[Use case]: I need to purge Pgres data older than 30 days as a part of a compliance step.
[Issue]: Say, if I partition my table
monthly
using timestamp, use retention as1 month
inpartman.part_config
and use the default cronbgw.interval
(hourly). Now, on 1st Feb, if there is a db entry with timestamp = 1st Jan, it will detach the partition of January month from main table and remove the entries made on 31st Jan. So, I end up deleting data which is one day old.If I partition the table daily, then my goal is achieved but the number of partitions become 30.
[Questions]
Beta Was this translation helpful? Give feedback.
All reactions