-
I am implementing a partitioning on a table based on an int id. For time-based partitioning, this feature is available through the infinite_time_partitions flag, however no such feature exists for ID based partitioning. Is there a way to achieve this functionality? Or would I need to manually call create_partition_id() ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
By your description here, you've gone and created the default and child table manually. The With time, there's a value from the system clock that's always increasing, independent of the data, so that's not a problem. For integer values, there's no such external value to base anything on in a general sense. The only way to do that sort of infinite operation for integer partitioning would be to completely disregard the premake value and just make a child table every single time maintenance is called no matter what. That doesn't seem ideal to me, especially when you have no new data being inserted related to that integer. If that integer is an epoch, there is an epoch mode for pg_partman to treat it as such and then I would just make sure you have premake set high enough to account for your expected data window. |
Beta Was this translation helpful? Give feedback.
-
Also, manually calling create_partition_id() wouldn't work either. It only creates a new child table based on the premake value and the current data. |
Beta Was this translation helpful? Give feedback.
By your description here, you've gone and created the default and child table manually. The
create_parent()
function will do this for you and with a default premake of 4, will make 4 child tables ahead of the starting child table. You can increase the premake value with thep_premake
parameter tocreate_parent()
to have it initially create more if needed. Note that will permanently set that partition set's premake to that value so that it is always that many child tables ahead based on current data. You can always update the config table to increase/decrease premake as needed as well.With time, there's a value from the system clock that's always increasing, independent of the data, so th…