From: | "Robert Haas" <robertmhaas(at)gmail(dot)com> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: bad selectivity estimates for CASE |
Date: | 2009-01-06 12:25:29 |
Message-ID: | 603c8f070901060425t485fb8d8nb79735ed72982d5a@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On Mon, Jan 5, 2009 at 11:40 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "Robert Haas" <robertmhaas(at)gmail(dot)com> writes:
>> While looking at a complex query that is being poorly planned by
>> PostgreSQL 8.2.9, I discovered that any non-trivial CASE...WHEN
>> expression seems to produce a selectivity estimate of 0.005.
>
> If you have an idea for a non-silly estimate, feel free to enlighten
> us...
Well, presumably CASE WHEN <expr1> THEN <constant1> WHEN <expr2> THEN
<constant2> WHEN <expr3> THEN <constant3> ... END = <constantn> could
be simplified to <exprn>. But that's not going to happen in time to
do me any good on this query, if it ever happens (and might not be
sufficient anyway since the selectivity estimates of <expr1> may not
be very good either), so I was more looking for suggestions on coping
with the situation, since I'm sure that I'm not the first person to
have this type of problem.
...Robert
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-01-06 13:22:00 | Re: bad selectivity estimates for CASE |
Previous Message | Dmitry Koterov | 2009-01-06 11:23:16 | Re: Bgwriter and pg_stat_bgwriter.buffers_clean aspects |