Re: Query plan w/ like clause question

From: Steve Wranovsky <stevew(at)merge(dot)com>
To: Richard Poole <rp(at)guests(dot)deus(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Query plan w/ like clause question
Date: 2002-05-30 21:59:39
Message-ID: 4.3.2.7.2.20020530164734.00d12bd0@mail.merge.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Richard,

Thanks for the quick feedback! Changing to the C locale fixed the problem and
the queries are now less than a fraction of a second, as I'd expect. Thanks again.

Steve

At 12:58 AM 5/30/02 +0100, you wrote:
>On Wed, May 29, 2002 at 03:58:53PM -0500, Steve Wranovsky wrote:
>>
>> I am having some strange results using a "like" clause under 7.2.1 w/ Linux.
>
>...
>
>> When I try to a like clause with a '%' wildcard that will return the
>> same results as the exact match, the query does a sequential scan
>> instead of using the index, and takes a significant amount of time
>> to execute.
>
>An index scan can't be used for a LIKE unless you're running in the C
>locale, because other locales may have sorting rules which would give
>incorrect results. Probably you're using en_US? Unfortunately you
>need to re-run "initdb" to change this, which means dumping and
>restoring your databases. See section 3.2 of the Administrator's
>Guide.
>
>Richard

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Shaun Thomas 2002-05-30 22:01:10 Re: horrendous query challenge :-)
Previous Message Scott Marlowe 2002-05-30 21:53:08 Re: connection refused problem