Re: [PATCH] ALTER TABLE ADD FOREIGN KEY to partitioned table, is not parallelized

2025-07-23 Thread Dimitrios Apostolou
Hello Stepan! I can see you tested my patch by itself, and with the following command: On Monday 2025-07-21 07:58, Stepan Neretin wrote:       pg_restore -d "$DB_NAME" -j "$JOBS" --clean --if-exists --freeze "$DUMP_FILE" > /dev/null On the other hand, I have tested combining --freeze with -

Re: [PATCH] ALTER TABLE ADD FOREIGN KEY to partitioned table, is not parallelized

2025-07-20 Thread Stepan Neretin
On Mon, Jul 21, 2025 at 12:24 PM Dimitrios Apostolou wrote: > > > > FWIW I implemented a pg_restore --freeze patch, see attached. It needs > > another patch of mine from [1] that implements pg_restore --data-only > > --clean, which for parallel restores encases each COPY in its own > transaction

Re: [PATCH] ALTER TABLE ADD FOREIGN KEY to partitioned table, is not parallelized

2025-06-17 Thread Dimitrios Apostolou
FWIW I implemented a pg_restore --freeze patch, see attached. It needs another patch of mine from [1] that implements pg_restore --data-only --clean, which for parallel restores encases each COPY in its own transaction and prepends it with a TRUNCATE. All feedback is welcome. [1] https://ww

[PATCH] ALTER TABLE ADD FOREIGN KEY to partitioned table, is not parallelized

2025-06-09 Thread Dimitrios Apostolou
On Thu, 5 Jun 2025, Frédéric Yhuel wrote: On 6/4/25 16:12, Dimitrios Apostolou wrote: In general I have noticed most operations are slower after a succesful pg_restore until VACUUM is complete, which is unfortunate as the database is huge and it takes days to run. Something I have on my list

Re: ALTER TABLE ADD FOREIGN KEY to partitioned table, is not parallelized

2025-06-05 Thread Frédéric Yhuel
On 6/5/25 16:13, Frédéric Yhuel wrote: On 6/4/25 16:12, Dimitrios Apostolou wrote: In general I have noticed most operations are slower after a succesful pg_restore until VACUUM is complete, which is unfortunate as the database is huge and it takes days to run. Something I have on my list

Re: ALTER TABLE ADD FOREIGN KEY to partitioned table, is not parallelized

2025-06-05 Thread Frédéric Yhuel
On 6/4/25 16:12, Dimitrios Apostolou wrote: In general I have noticed most operations are slower after a succesful pg_restore until VACUUM is complete, which is unfortunate as the database is huge and it takes days to run. Something I have on my list to try, is whether a COPY FREEZE would al

Re: ALTER TABLE ADD FOREIGN KEY to partitioned table, is not parallelized

2025-06-04 Thread Dimitrios Apostolou
On Wed, 4 Jun 2025, Frédéric Yhuel wrote: On 6/3/25 17:34, Dimitrios Apostolou wrote: The backend process for each of the above ALTER TABLE commands, does not   parallelize the foreign key checks for the different partitions. I   know, because in the logs I see gigabytes of temporary files

Re: ALTER TABLE ADD FOREIGN KEY to partitioned table, is not parallelized

2025-06-04 Thread Frédéric Yhuel
On 6/3/25 17:34, Dimitrios Apostolou wrote: The backend process for each of the above ALTER TABLE commands, does not   parallelize the foreign key checks for the different partitions. I   know, because in the logs I see gigabytes of temporary files being   written, with the CONTEXT showing

ALTER TABLE ADD FOREIGN KEY to partitioned table, is not parallelized

2025-06-03 Thread Dimitrios Apostolou
Hello list, I'm debugging the abysmal performance of pg_restoring a huge (10TB) database, which includes a table with more than 1000 partitions. As part of pg_restore -j... --section=post-data I see *days* being spent in the sequential creation of foreign keys: ALTER TABLE the_master_partit