Support Postgres Declarative Partitioning
- Dominant language
- Go
- Stars
- 17.2k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
- [x] I have searched the [issues](https://github.com/ent/ent/issues) of this repository and believe that this is not a duplicate.
## Summary 💡
- [ ] Add support for declaring tables as `PARTITIONED BY RANGE/HASH/LIST ("id")`, along with creating a default partition.
- [ ] Initially support partition key being the ID primary key
- [ ] Handle unique constraint limitations that come with partitions.
- [ ] Add API method for detaching the default partition, creating a new default, and reattaching the old default with an appropriate range. This will enable creating partitions on demand at a constant interval, without having a partition key be a timestamp.
## Motivation 🔦
Partitioning enables us to delete old data in bulk fast. Deleting data from big tables takes a very long time so we partition the data by date (technically by ID as explained above). This way we can delete data from a single partition in a matter of seconds.
Thanks!
Contributor guide
Assessment
This issue has not been assessed yet.