Re: notice about costly ri checks (2)

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Michael Glaesemann <grzm(at)myrealbox(dot)com>
Cc: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: notice about costly ri checks (2)
Date: 2004-03-05 14:53:54
Message-ID: 200403051453.i25ErsU05539@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Michael Glaesemann wrote:
>
> On Mar 5, 2004, at 1:49 PM, Bruce Momjian wrote:
>
> > Agreed. The current text is:
> >
> > NOTICE: costly cross-type foreign key because of component 1
> >
> > Seems we should say something like:
> >
> > NOTICE: foreign key constraint 'constrname' must use a costly
> > cross-type conversion
>
> It seems to me that in some ways this is similar to the situation where
> indexes are created to enforce a UNIQUE constraint. Indexes also incur
> additional overhead for inserts and updates, but make no mention of the
> cost: the DBA is assumed to know that, or they can check the docs if
> they're interested in why such a notice is being raised. I'd think
> something as simple as
>
> NOTICE: foreign key constraint 'constrname' will require a cross-type
> conversion
>
> similar to
> NOTICE: CREATE TABLE / UNIQUE will create implicit index
> "foox_interesting_key" for table "foox"

The issue is that an index always has a cost (pretty constant cost),
which is known to the creator. The case he is warning about is when
primary/foreign key types don't match, and a costly comparison will be
required to do the referential integrity checking.

Also, seems this should be a WARNING, rather than a notice. NOTICE, I
think, is for normal behavior (creating a sequence for SERIAL), and
warning is for unusual behavior, which this is.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2004-03-05 14:54:58 Re: notice about costly ri checks (2)
Previous Message Andrew Dunstan 2004-03-05 14:10:56 Re: [HACKERS] Another crack at doing a Win32 build under MINGW