Re: Partial indexes

From: elein <elein(at)varlena(dot)com>
To: "Florian G(dot) Pflug" <fgp(at)phlo(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, elein <elein(at)varlena(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Partial indexes
Date: 2006-04-19 03:08:51
Message-ID: 20060419030851.GY20430@varlena.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Apr 19, 2006 at 03:51:27AM +0200, Florian G. Pflug wrote:
> Tom Lane wrote:
> >elein <elein(at)varlena(dot)com> writes:
> >>I think I want to:
> >> create unique index pk on table tbl (keyp1, keyp2);
> don't you want
> create unique inde pk on table tbl (keyp1, keyp2) where keyp3 is null
> here?
>
> >> create unique index range on table tbl (keyp1, keyp2, keyp3) where
> >> keyp3 is not null;
> >
> >>Are these indexes redundant given uniqueness requirement and the type of
> >>queries
> >>that will be run against the table?
>
> greetings, Florian Pflug
>

Yes, you are right. I ended up creating a unique constraint on the three
parts of the key and a unique index on keyp1, keyp2 where keyp3 is null.
I think this will cover all cases as simply as possible.

Thanks,

--elein
elein(at)varlena(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Brendan Duddridge 2006-04-19 04:49:02 Re: Weird error updating table
Previous Message Florian G. Pflug 2006-04-19 01:51:27 Re: Partial indexes