Replies: 2 comments 2 replies
-
The locking is more around the rows and because you have foreign keys, that may cause some cascading locks around those rows in other tables as well. The rows have to be exclusively locked because they are moving between two different tables. The length of the lock is really dependent on the interval of partitioning because it has to move as many rows as fit in a single child table at one time. So the longest downtime is going to be however long it takes to move the data for a single child. It doesn't all have to be done at one time, so you could take smaller outages over a longer period of time. If the data that's being accessed more frequently is more recent data, you could wait until that data isn't accessed quite so much and then work on migrating that data then. Then the locks won't be quite as intrusive. Newer data should hopefully be going into the partitioned tables. |
Beta Was this translation helpful? Give feedback.
-
Thanks @keithf4 for quick reply. When you say the locking is around the rows, you mean all rows in the default table or just the rows that are being moved to one specific partition? Also is there a way to specifiy the partition ID I want to move? |
Beta Was this translation helpful? Give feedback.
-
I'm trying to follow the online process described here:
https://github.com/pgpartman/pg_partman/blob/master/doc/pg_partman_howto_native.md#online-partitioning
So far so good, until I got to the step where I need to call partition_data_proc().
I can't have a big downtime during this process because this can take more than a day to get finished.
I noticed partition_data_proc() is maybe locking the table for read and write. Does that make sense?
Also wondering if it's locking because I have new FKs refererencing the partitioned table or just because it's the standard to lock everything.
I was expecting it to lock at least just the partition it's moving.
Beta Was this translation helpful? Give feedback.
All reactions