Re: constraint with reference to the same table

From: Victor Yegorov <viy(at)nordlb(dot)lv>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: Rudi Starcevic <rudi(at)oasis(dot)net(dot)au>, Postgres Performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: constraint with reference to the same table
Date: 2003-05-15 01:03:41
Message-ID: 20030515010341.GD1549@nordlb.lv
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

* Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> [15.05.2003 03:54]:
>
> That can be a win, but if you're actually dropping and adding the
> constraint again it may not be on large tables since it'll still do a
> whole bunch of index lookups to check the existing rows when the alter
> table add constraint happens. Disabling triggers and re-enabling them is
> faster but breaks the guarantee of the constraint.

You're right. I thought of big tables after posting the reply. My solution
is suitable for my case, i.e. not so big tables.

Returning to the very first question I asked.
May be it is usefull to implicitly create index on foreign key columns?
Actually, untill you had pointed on seq. scans, I thought Postgres is
using internal indicies - don't ask me why.

--

Victor Yegorov

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Rudi Starcevic 2003-05-15 01:09:12 Re: constraint with reference to the same table
Previous Message Rudi Starcevic 2003-05-15 00:53:09 Re: constraint with reference to the same table