Re: LIKE and indexes? - Mailing list pgsql-general

From Alexander Jerusalem
Subject Re: LIKE and indexes?
Date
Msg-id 4.3.2.7.0.20010315023628.00cf9100@pop.chello.at
Whole thread Raw
In response to LIKE and indexes?  (Alexander Jerusalem <alexander.jerusalem@pop.chello.at>)
List pgsql-general
Thanks for your answer, Alex!

I've done an EXPLAIN and I saw that no index was used although my SQL
statement had a wild card only at the end as you pointed out ('blah%'). My
guess is that this is because of the locale support.

Regards,
Alexander Jerusalem


At 01:22 15.03.01, adb wrote:
>When in doubt, try the explain command
>
>Not exactly sure about postgres but in general LIKE can
>only use an index in the case of LIKE "Something%"
>
>LIKE "%Something" or LIKE "%Something%"
>won't use an index since it would have to scan the entire
>index to find all matches.
>
>Alex.
>
>
>
>On Wed, 14 Mar 2001, Alexander Jerusalem wrote:
>
> > Hi,
> >
> > Can anyone telle me if and when a LIKE query uses an index? I've compiled
> > postgres with locale support. Does that have any influence indexes?
> >
> > thanks,
> >
> > Alexander Jerusalem
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 4: Don't 'kill -9' the postmaster
> >
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Sluggish INSERTS with Foreign Keys (7.1beta5)
Next
From: adb
Date:
Subject: Re: How to avoid large tables - WAS RE: Fast Inserts and H ardware Questions