Re: How to use index in case insensitive substing search

From: "Hakan Kocaman" <Hakan(dot)Kocaman(at)digame(dot)de>
To: "Andrus" <eetasoft(at)online(dot)ee>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to use index in case insensitive substing search
Date: 2006-06-06 09:51:01
Message-ID: 84AAD313D71B1D4F9EE20E739CC3B6EDE97688@ATLANTIK-CL.intern.digame.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Andrus,

how about:
create index nimib2 on firma1.klient(lower(nimi) varchar_pattern_ops);
^^^
> explain analyze select nimi from firma1.klient where lower(nimi) like
> 'mokter%'
>
> "Total runtime: 0.877 ms"
> explain analyze select nimi from firma1.klient where nimi
> like 'Mokter%'
>
> for same data uses index:
> "Total runtime: 9.615 ms"

Hmm...Index-use seems to slow down the query.

Best regards

Hakan Kocaman
Software-Development

digame.de GmbH
Richard-Byrd-Str. 4-8
50829 Köln

Tel.: +49 (0) 221 59 68 88 31
Fax: +49 (0) 221 59 68 88 98
Email: hakan(dot)kocaman(at)digame(dot)de

> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org
> [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Andrus
> Sent: Tuesday, June 06, 2006 10:58 AM
> To: pgsql-general(at)postgresql(dot)org
> Subject: [GENERAL] How to use index in case insensitive
> substing search
>
>
> How to force postgres to use index for the following query (I
> can change the
> query to equivalent if required)
>
> select nimi from klient where lower(nimi) like 'test%'
>
> Currently it does NOT use index:
>
> create index nimib2 on firma1.klient(lower(nimi) bpchar_pattern_ops);
>
> Andrus.
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>

Responses

Browse pgsql-general by date

  From Date Subject
Next Message dananrg 2006-06-06 11:07:06 Re: Best open source tool for database design / ERDs?
Previous Message Andrus 2006-06-06 09:50:31 Re: How to use index in case insensitive substing search