From: | Ron <ronljohnsonjr(at)gmail(dot)com> |
---|---|
To: | pgsql-admin(at)lists(dot)postgresql(dot)org |
Subject: | Re: Disable unique constraint in Postgres |
Date: | 2022-11-27 22:07:22 |
Message-ID: | f5b632d2-4549-9869-b971-5199fe7b5830@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
On 11/27/22 15:56, Mladen Gogala wrote:
> On 11/27/22 16:23, Ron wrote:
>>
>> Being an "enterprise dba", IMNSHO "disable constraint" (and more
>> specifically "*disable index*") is a /great/ feature for maintaining
>> tables. For example, if you need to purge a *lot* of records into a
>> table, disable all indices except the index supporting your WHERE CLAUSE,
>> delete the data, and then re-enable the indices. Bonus points if the
>> REENABLE commands can be done in parallel.
>>
>> Sure, you /can/ dig around for all of the CREATE INDEX statements, but
>> that leads to possible errors: "oops, forgot to recreate one of them", or
>> "typo caused one to fail". OTOH, DISABLE INDEX and REENABLE INDEX are
>> idiot-proof, and can be automated.
>>
>> --
>> Angular momentum makes the world go 'round.
>
>
> You are aware that in Oracle "ALTER TABLE ENABLE CONSTRAINT" rebuilds the
> index used to enforce the constraint? You will not save any time by
> disabling and re-enabling constraints.
>
Eliminating mistakes and reducing DBA work are the point of DISABLE and
ENABLE INDEX, not saving clock time during the maintenance window.
--
Angular momentum makes the world go 'round.
From | Date | Subject | |
---|---|---|---|
Next Message | Samed YILDIRIM | 2022-11-27 22:23:55 | Re: Disable unique constraint in Postgres |
Previous Message | Mladen Gogala | 2022-11-27 21:56:03 | Re: Disable unique constraint in Postgres |