-
Notifications
You must be signed in to change notification settings - Fork 309
Description
Our application handles deletes 'softly', that is when a user indicates something should be deleted it is marked as deleted but not actually removed from the database until some retention peroid has passed.
As an example consider a table with the following columns
- A timestamp representing the time of the record (record_timestamp)
- A boolean indicating if the record has been deleted (deleted_bool)
- A timestamp indicating when the record was deleted (deleted_timestamp)
Currently the table is partitioned by record_timestamp for performance reasons. However, we now want to split this table into a set of deleted records and a set of live records. The idea is to partition the table first based on deleted_bool and then partition the live child partition by record_timestamp and the deleted child partition by deleted_timestamp. This would simplify removing old records as we could just drop the oldest partition when it got too old on the deleted side.
Splitting the table into a set of live and dead records seems like it can be done with partman today if we change the deleted_bool column from a bool to an integer and just constrain the range of partitions to 0 and 1. However I cannot see a way to partition the live side by one column and the deleted side by another column. Is this possible? If not, is there any interest in adding it? I understand its a very niche request.