Re: Indexes with LIKE

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Julian Scarfe <julian(dot)scarfe(at)ntlworld(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Indexes with LIKE
Date: 2002-07-13 15:28:34
Message-ID: 20020713082522.U19431-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sat, 13 Jul 2002, Julian Scarfe wrote:

> I've noticed a difference in behaviour between a server running version 6.x
> and one running 7.2.1 in use of indexes with LIKE.
>
> With an index on foo,
>
> WHERE foo LIKE 'bar%'
>
> uses the index (as I would expect it to) on the 6.x box, but uses a
> sequential scan (really slow) on the 7.2.1 box.
> It's possible that I've set (or failed to set) a run-time parameter that
> controls the behaviour, but I don't know what that might be. ANALYZEing the
> table doesn't modify the behaviour.
>
> I can't find any mention of this in the documentation -- any pointers would
> be appreciated.

You need to have made the database in C locale in order to get index scans
from LIKE. I think that's mentioned in the Localization section of the
admin guide, but I could be remembering that wrong.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Julian Scarfe 2002-07-13 18:18:18 Re: Indexes with LIKE
Previous Message Bruce Momjian 2002-07-13 14:50:59 Re: pg_restore cannot restore index