Re: Speeding up adding fky on a very large table

From: Ravi Krishna <s_ravikrishna(at)aol(dot)com>
To: ronljohnsonjr(at)gmail(dot)com, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Speeding up adding fky on a very large table
Date: 2022-10-19 20:44:53
Message-ID: 726737233.489080.1666212293670@mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Our issue is that it takes 20hrs to index the full table. Hopefully we can add FK in multiple child partitions concurrently, otherwise doing it per partition offers no advantage from performance pov.
Need to test. Hopefully PG should not lock the referred table during the first build, stopping concurrent execution of other partitions.


In vanilla Postgresql (including RDS Postgresql) you can add the FK to each partition and then ALTER TABLE ONLY the parent table.

Don't know about Aurora, though


In response to

Browse pgsql-general by date

  From Date Subject
Next Message Erik Wienhold 2022-10-19 21:14:17 Re: Cannot restore windows dump on linux
Previous Message Bruno Wolff III 2022-10-19 20:36:02 Postgres 15 upgrades and template1 public schema