Re: UNIQUE constraint and indexing

From: Keary Suska <hierophant(at)pcisys(dot)net>
To: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: UNIQUE constraint and indexing
Date: 2001-10-01 16:15:32
Message-ID: B7DDF2C4.3EC6%hierophant@pcisys.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> So, the unique index will still be used when processing SELECT
> queries, right? In other words, is the index foo_baz_idx redundant?

Yes. It is better to think of "Unique" as creating an index with the added
benefit of a "unique" constraint.

Keary Suska
Esoteritech, Inc.
"Leveraging Open Source for a better Internet"

> From: Arcady Genkin <a(dot)genkin(at)utoronto(dot)ca>
> Date: 01 Oct 2001 10:45:18 -0400
> To: pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] UNIQUE constraint and indexing
>
> Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> writes:
>
>> On 27 Sep 2001, Arcady Genkin wrote:
>>
>>> Is the index, created implicitely by "UNIQUE" constraint, the same
>>> kind as created explicitely with "CREATE INDEX"? In other words,
>>> is the following piece of SQL redundant?
>>>
>>> create table foo (
>>> bar serial primary key,
>>> baz text not null unique );
>>> create index foo_baz_idx on foo(baz);
>>
>> Apart from the index for unique being a unique index, I believe so.
>
> So, the unique index will still be used when processing SELECT
> queries, right? In other words, is the index foo_baz_idx redundant?
>
> THanks,
> --
> Arcady Genkin
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Krog, Kenneth 2001-10-01 17:09:02 Extracting time
Previous Message Keary Suska 2001-10-01 16:08:18 Re: Perl connection to Postgres?