Re: LIKE and SIMILAR TO

Поиск
Список
Период
Сортировка
От Ivan Sergio Borgonovo
Тема Re: LIKE and SIMILAR TO
Дата
Msg-id 20080822140048.675666b8@dawn.webthatworks.it
обсуждение исходный текст
Ответ на LIKE and SIMILAR TO  ("c k" <shreeseva.learning@gmail.com>)
Список pgsql-general
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


В списке pgsql-general по дате отправления:

Предыдущее
От: "c k"
Дата:
Сообщение: Re: LIKE and SIMILAR TO
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: problem with foreign keys + data-only backup