Re: Partial indexes - Mailing list pgsql-general

From Tom Lane
Subject Re: Partial indexes
Date
Msg-id 19372.1145398867@sss.pgh.pa.us
Whole thread Raw
In response to Partial indexes  (elein <elein@varlena.com>)
Responses Re: Partial indexes  ("Florian G. Pflug" <fgp@phlo.org>)
List pgsql-general
elein <elein@varlena.com> writes:
> I think I want to:
>     create unique index pk on table tbl (keyp1, keyp2);
>     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?

If all (keyp1, keyp2) pairs are distinct then I see no particular use in
the second index; it doesn't check anything that's not implied by the
first index, and it doesn't offer any extra search selectivity either.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: PostgreSQL and the OCFS2 filesystem
Next
From: "Kynn Jones"
Date:
Subject: Bulk inserts within a Perl script?