Re: like performance w/o wildcards.

From: Joseph Shraibman <jks(at)selectacast(dot)net>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-general(at)postgreSQL(dot)org
Subject: Re: like performance w/o wildcards.
Date: 2003-08-04 22:25:43
Message-ID: 3F2EDD67.9000409@selectacast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bruce Momjian wrote:
> Joseph Shraibman wrote:
>
>>Bruce Momjian wrote:
>>
>>>Joseph Shraibman wrote:
>>>
>>>
>>>>Bruce Momjian wrote:
>>>>
>>>>
>>>>
>>>>>Oh, that's interesting. I think a LIKE will already use an index,
>>>>>except for non-C locales. Is that the issue?
>>>>>
>>>>
>>>>Yes, I'm using latin1. Why does an index only work on C?
>>>
>>>
>>>Because we can't determine what caracters are before/after a given
>>>character to do a restriction, e.g. col LIKE 'F*' add col >= 'F' AND col
>>>< 'G'. In non-C, we don't know the ordering.
>>>
>>
>>Then what is the index for?
>
>
> The index is for non-LIKE comparisons, like = and >.
>
My point is what is the difference? If the index is done char by char then LIKE ought to
be able to use the index to find 'F*', no matter what the locale is. What can't you
figure out what is before/after a given char? Don't you have that information? Don't you
need it to create the index in the first place?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-08-04 22:35:38 Re: like performance w/o wildcards.
Previous Message Tom Lane 2003-08-04 22:07:49 Re: varchar, text and cidr