Re: Problem (bug?) with like

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: drheart(at)wanadoo(dot)es, Lista PostgreSql <pgsql-general(at)postgresql(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Problem (bug?) with like
Date: 2001-12-04 19:00:32
Message-ID: 200112041900.fB4J0W421336@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

> I am thinking that the rules for selectivity of LIKE patterns probably
> need to be modified. Presently the code assumes that a long constant
> string has probability of occurrence proportional to the product of the
> probabilities of the individual letters. That might be true in a random
> world, but people don't search for random strings. I think we need to
> back off the selectivity estimate by some large factor to account for
> the fact that the pattern being searched for is probably not random.
> Anyone have ideas how to do that?

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?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laszlo Hornyak 2001-12-04 19:18:52 Re: java stored procedures
Previous Message Tom Lane 2001-12-04 18:38:23 Re: Sending Explain output to a perl client

Browse pgsql-hackers by date

  From Date Subject
Next Message Laszlo Hornyak 2001-12-04 19:18:52 Re: java stored procedures
Previous Message Hannu Krosing 2001-12-04 18:31:13 Re: Undocumented feature costs a lot of performance in