pg_partman icon indicating copy to clipboard operation
pg_partman copied to clipboard

partition_data_proc taking too long to transfer the data

Open harshil007 opened this issue 4 years ago • 1 comments

I have a table with >500 million rows that I want to partition. So I followed the offline partitioning steps given here, but the partition_data_proc procedure is taking too long to complete even with larger batch size.

I setup the monthly partitions on timestamp field using SELECT partman.create_parent('public.new_table', 'timestamp', 'native', 'monthly');

I ran the proc CALL partman.partition_data_proc('public.new_table', p_interval := '50000', p_source_table := 'public.old_table'); and it ran for ~15 hours and after that it was killed by postgres. Even after that, all of the data was not transferred from the source table.

Screenshot 2022-02-15 at 11 25 13 AM Screenshot 2022-02-15 at 11 25 25 AM

Just for comparison, I also setup partitions manually for the same table and copied the data from the old table to the new in batches of 50000 rows and it took only around ~3 hours to copy everything.

I'm not sure if I'm doing something wrong or if there is some issue with the proc. Let me know if more information is needed

harshil007 avatar Feb 15 '22 09:02 harshil007

Apologies I did not see your initial question over in the Discussion section. I answered there first before I saw the question here again. Please continue the discussion there for now.

https://github.com/pgpartman/pg_partman/discussions/436

keithf4 avatar Feb 15 '22 20:02 keithf4