Re: LIKE and indexes?

From: adb <adb(at)Beast(dot)COM>
To: Alexander Jerusalem <alexander(dot)jerusalem(at)pop(dot)chello(dot)at>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: LIKE and indexes?
Date: 2001-03-15 00:22:25
Message-ID: Pine.GSO.4.10.10103141617350.2561-100000@hairdini.beast.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gordon A. Runkle 2001-03-15 00:23:27 Re: Scalability
Previous Message adb 2001-03-15 00:15:08 Re: Fast Inserts and Hardware Questions