Re: difference between a unique constraint and a unique index ??? - Mailing list pgsql-performance

From Alvaro Herrera
Subject Re: difference between a unique constraint and a unique index ???
Date
Msg-id 20071112145630.GC14247@alvh.no-ip.org
Whole thread Raw
In response to difference between a unique constraint and a unique index ???  (Dave Cramer <pg@fastcrypt.com>)
Responses Re: difference between a unique constraint and a unique index ???  (Dave Cramer <pg@fastcrypt.com>)
Re: difference between a unique constraint and a unique index ???  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
Dave Cramer wrote:
> In order to get like queries to use an index with database initialized with
> a UTF-8 character set I added a unique index to a table with a
> varchar_pattern_ops
>
> This table already had a unique constraint on the column so I dropped the
> unique constraint.
>
> I can't give exact measurements however this caused my application to slow
> down considerably.
>
> The only thing I can figure is that the varchar_pattern_ops operator is
> significantly slower ???
>
> Is there some other piece of the puzzle to fill in ?

Well, AFAIK the index with varchar_pattern_ops is used for LIKE queries,
whereas the other one is going to be used for = queries.  So you need to
keep both indexes.

--
Alvaro Herrera                  http://www.amazon.com/gp/registry/5ZYLFMCVHXC
Officer Krupke, what are we to do?
Gee, officer Krupke, Krup you! (West Side Story, "Gee, Officer Krupke")

pgsql-performance by date:

Previous
From: Dave Cramer
Date:
Subject: difference between a unique constraint and a unique index ???
Next
From: Dave Cramer
Date:
Subject: Re: difference between a unique constraint and a unique index ???