Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 9DD6A37C705 for ; Mon, 12 Nov 2007 11:13:28 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 06999-02 for ; Mon, 12 Nov 2007 11:13:26 -0400 (AST) Received: from beaver.fastcrypt.com (beaver.fastcrypt.com [64.7.141.17]) by postgresql.org (Postfix) with ESMTP id 33AF737C730 for ; Mon, 12 Nov 2007 11:13:26 -0400 (AST) Received: from [192.168.1.14] (dcdsl.ebox.com [64.7.143.116]) by beaver.fastcrypt.com (Postfix) with ESMTP id D51A715806D0; Mon, 12 Nov 2007 10:23:05 -0500 (EST) Cc: postgresql performance list Message-Id: From: Dave Cramer To: Alvaro Herrera In-Reply-To: <20071112145630.GC14247@alvh.no-ip.org> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v912) Subject: Re: difference between a unique constraint and a unique index ??? Date: Mon, 12 Nov 2007 10:13:24 -0500 References: <20071112145630.GC14247@alvh.no-ip.org> X-Mailer: Apple Mail (2.912) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/176 X-Sequence-Number: 27591 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