Re: [HACKERS] Problem (bug?) with like - Mailing list pgsql-general

From Hannu Krosing
Subject Re: [HACKERS] Problem (bug?) with like
Date
Msg-id 3C0D0839.2010102@tm.ee
Whole thread Raw
In response to Re: Problem (bug?) with like  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-general

Tom Lane wrote:

>Bruce Momjian <pgman@candle.pha.pa.us> writes:
>
>>But what about '%A%' vs. '%AC%'.  Seems the second is reasonably
>>different from the first the our optimizer may be fine with that.  Is it
>>only when the strings get longer that we lose specificity?
>>
>
>Yeah, I don't think that the estimates are bad for one or two
>characters.  But the estimate gets real small real fast as you
>increase the number of match characters in the LIKE pattern.
>We need to slow that down some.
>
Could we just assign weights to first few characters and then consider
only these
first few characters when determinind probabbility of finding it ?

If someone searches for '%New York City%' we have quite good reasons to
believe
that there are some of these in there so we should factor in the fact
that usually one searches
for strings that do exist by said weights.

Another option would be to gather statistics not only on individual
letters but on bi- or
trigraphs. Then as a next step we could implement proper trigraph indexes ;)

----------------
Hannu



pgsql-general by date:

Previous
From: Laszlo Hornyak
Date:
Subject: Re: java stored procedures
Next
From: "Steve Brett"
Date:
Subject: Re: When do I Vacuum ?