-
Notifications
You must be signed in to change notification settings - Fork 69
Description
postgresql 11.5, pathman 1.5
If there is a large distance between the values in the table, a lot of partitions are created, which is why the operation may never be completed (if the number of partitions exceeds 1000).
For example, in the table there are two records of the field by which the table is ranged with the values 2010年01月01日 and 3999年12月01日 and the month interval is set.
SELECT create_range_partitions (relid, '_period', '1 mon' :: interval);
I propose a patch that solves the problem by creating partitions only for which there are values in the table, and then, when automatically creating partitions, only those are created for which the value in the record falls into the interval.
При наличии в таблице большого разрыва между значениями создается очень много партиций, отчего операция может не завершится никогда (если количество партиций превышает 1000).
Например в таблице две записи поля по которому ранжируется таблица со значениями 2010年01月01日 и 3999年12月01日 и задается интервал например месяц или ещё меньше.
SELECT create_range_partitions(relid, '_period', '1 mon'::interval);
Предлагаю патч который решает проблему путем создания партиций только тех для которых есть значения в таблице и далее при автоматическом создании партиций создаются только те для которых значение в записи попало в интервал.