I'm trying to make dynamic partitions in Postgres.
What am I trying to achieve:
I will have tableA that will have a lot of data and will have a column with some_id which will be heavily used in where statement.
So, my plan is to have partition by list with some_id value.
How to achieve dynamic partitioning, So when new id is inserted partition is dynamically created?
Add a comment
|
2 Answers
There is no way to do that in PostgreSQL currently.
2 Comments
shonster88
Thanks. What about a bit hardcoding with trigger? Would that be considered as good practice?
Laurenz Albe
I tried, and it doesn't work. Basically, a trigger that is run from an action on a table cannot modify the table's definition.