Re: difference between a unique constraint and a unique index ???

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
      message can get through to the mailing list cleanly

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux