From: Dave Cramer <pg@fastcrypt.com>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: postgresql performance list <pgsql-performance@postgresql.org>
Subject: Re: difference between a unique constraint and a unique index ???
Date: Mon, 12 Nov 2007 10:13:24 -0500
Message-ID: <E36561B8-762D-41C9-A903-4413EE3B3253@fastcrypt.com> (raw)
In-Reply-To: <20071112145630.GC14247@alvh.no-ip.org>
References: <E9D1152F-7846-4F03-A435-F1C05E034000@fastcrypt.com>
<20071112145630.GC14247@alvh.no-ip.org>
On 12-Nov-07, at 9:56 AM, Alvaro Herrera wrote:
> 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.
>
You would be correct, thanks for the quick answer.
Dave
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: pg@fastcrypt.com, alvherre@alvh.no-ip.org
Subject: Re: difference between a unique constraint and a unique index ???
In-Reply-To: <E36561B8-762D-41C9-A903-4413EE3B3253@fastcrypt.com>
References: <E9D1152F-7846-4F03-A435-F1C05E034000@fastcrypt.com> <20071112145630.GC14247@alvh.no-ip.org> <E36561B8-762D-41C9-A903-4413EE3B3253@fastcrypt.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox