| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Marinos Yannikos <mjy(at)geizhals(dot)at> |
| Cc: | pgsql-performance(at)postgresql(dot)org |
| Subject: | Re: bad query plans for ~ "^string" (and like "string%") (8.3.6) |
| Date: | 2009-04-08 14:28:09 |
| Message-ID: | 9986.1239200889@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-performance |
Marinos Yannikos <mjy(at)geizhals(dot)at> writes:
> Marinos Yannikos wrote:
>> (what exactly does ANALYZE look at for text columns? in our case, about
>> 7% of the rows match the index condition, so it seems that left-anchored
>> regexp/like matches are not evaluated using the gathered
>> most-common-value list at all)
> oops, I think I gave myself the answer there. Of course the
> most-common-value list will not help if all the values that match the
> "bad" index condition exist only once, but have a common prefix...
The costing is really done off the range condition ((e >= 'ean'::text)
AND (e < 'eao'::text) in your example). I wouldn't think it would have
such a hard time getting a good rowcount estimate for that. Maybe you
need to bump up the statistics target for that column?
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jeff | 2009-04-08 18:20:14 | Re: Best replication solution? |
| Previous Message | Robert Haas | 2009-04-08 13:53:58 | Re: bad query plans for ~ "^string" (and like "string%") (8.3.6) |