Re: Partial indexes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: elein <elein(at)varlena(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Partial indexes
Date: 2006-04-18 22:21:07
Message-ID: 19372.1145398867@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

elein <elein(at)varlena(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kynn Jones 2006-04-18 23:03:46 Bulk inserts within a Perl script?
Previous Message Tom Lane 2006-04-18 22:05:58 Re: PostgreSQL and the OCFS2 filesystem