From: Ivan Sergio Borgonovo <mail@webthatworks.it>
To: pgsql-general@postgresql.org
Subject: Re: LIKE and SIMILAR TO
Date: Fri, 22 Aug 2008 14:00:48 +0200
Message-ID: <20080822140048.675666b8@dawn.webthatworks.it> (raw)
In-Reply-To: <d8e7a1e30808220413s3e7c593fr7ee2be6af70ff1ca@mail.gmail.com>
References: <d8e7a1e30808220413s3e7c593fr7ee2be6af70ff1ca@mail.gmail.com>
On Fri, 22 Aug 2008 16:43:47 +0530
"c k" <shreeseva.learning@gmail.com> 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
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 using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: mail@webthatworks.it, pgsql-general@postgresql.org
Subject: Re: LIKE and SIMILAR TO
In-Reply-To: <20080822140048.675666b8@dawn.webthatworks.it>
* 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