Re: Why isn't there a IF NOT EXISTS clause on constraint creation?

From: Luca Ferrari <fluca1978(at)gmail(dot)com>
To: richard coleman <rcoleman(dot)ascentgl(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Why isn't there a IF NOT EXISTS clause on constraint creation?
Date: 2023-09-04 08:30:08
Message-ID: CAKoxK+7D_rz+LE9opK4ydHKsnFn1u0_UKeHz3dafTFap_dg_dQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Fri, Sep 1, 2023 at 2:58 PM richard coleman
<rcoleman(dot)ascentgl(at)gmail(dot)com> wrote:
>
> The schema is just fine. When loading large amounts of data, some tables are greater than a terabyte in size, you typically don't have keys or indices until after it finishes as that slows things down.
> I am not talking about two or three tables, but hundreds of tables. It's a rather labor intensive option for want of a IF NOT EXISTS clause.

Well, I see the scope for tools like sqitch here.
Also because testing the existence of the index, in your particular
case, is one small step. What happens if the index has been
invalidated somehow? You will see an existing index that is unusable,
and this could happen also with a fantomatic "IF NOT EXISTS" behavior,
so it sounds to me you need something even more smarter.

Luca

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Rajesh Kumar 2023-09-04 11:43:56 Re: Autovacuum not running properly
Previous Message Luca Ferrari 2023-09-04 08:25:36 Re: Autovacuum not running properly