Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 4A11C64FF9A for ; Fri, 22 Aug 2008 09:00:59 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 70989-05 for ; Fri, 22 Aug 2008 09:00:50 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp-OUT05A.alice.it (smtp-OUT05A.alice.it [85.33.3.5]) by postgresql.org (Postfix) with ESMTP id 76EB964FCF8 for ; Fri, 22 Aug 2008 09:00:53 -0300 (ADT) Received: from FBCMMO02.fbc.local ([192.168.68.196]) by smtp-OUT05A.alice.it with Microsoft SMTPSVC(6.0.3790.1830); Fri, 22 Aug 2008 13:59:14 +0200 Received: from FBCMCL01B06.fbc.local ([192.168.69.87]) by FBCMMO02.fbc.local with Microsoft SMTPSVC(6.0.3790.1830); Fri, 22 Aug 2008 14:00:51 +0200 Received: from kerberos.webthatworks.it ([82.48.101.129]) by FBCMCL01B06.fbc.local with Microsoft SMTPSVC(6.0.3790.1830); Fri, 22 Aug 2008 14:00:51 +0200 Received: from dawn.webthatworks.it (dawn.webthatworks.it [192.168.1.12]) by kerberos.webthatworks.it (Postfix) with ESMTP id 25AF5E6A96 for ; Fri, 22 Aug 2008 14:00:49 +0200 (CEST) Received: from dawn.webthatworks.it (localhost [127.0.0.1]) by dawn.webthatworks.it (Postfix) with ESMTP id 818353DAA4 for ; Fri, 22 Aug 2008 14:00:48 +0200 (CEST) Date: Fri, 22 Aug 2008 14:00:48 +0200 From: Ivan Sergio Borgonovo To: pgsql-general@postgresql.org Subject: Re: LIKE and SIMILAR TO Message-ID: <20080822140048.675666b8@dawn.webthatworks.it> In-Reply-To: References: Organization: http://www.webthatworks.it X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.11; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 22 Aug 2008 12:00:51.0382 (UTC) FILETIME=[B8F56560:01C9044E] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200808/794 X-Sequence-Number: 136624 On Fri, 22 Aug 2008 16:43:47 +0530 "c k" wrote: > Hello all, > As we are migrating our ERP application from MySQL to PostgreSQL > we have some difficulties. One of them is use of Like and Similar > to operators. We often use LIKE to search a string from front-end > without case sensetivity. As postgreSQL's LIKE is case sensitive, > we tried ILIKE and SIMILAR TO, but both are slower than LIKE and > we must need case insensitivity. How can we get this by increases > speed. All search columns are VARCHAR(100)to VARCHAR(250). > Currently without index. I was going to suggest to create a functional index create index on sometable using btree (upper(somecolumn)); select * from sometable where upper(somecolumn) like '%' || upper(somestring) || '%'; but indexes aren't going to work if you're searching with a prefixed %. I was wondering what are the performances of postgresql vs. MySQL in such case. Anyway I'd tweak postgresql.conf before complaining it is slower than MySQL. I've been surprised as well at how postgresql can be fast. -- Ivan Sergio Borgonovo http://www.webthatworks.it