Re: bad selectivity estimates for CASE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 5, 2009 at 11:40 PM, Tom Lane <tgl@xxxxxxxxxxxxx> wrote:
> "Robert Haas" <robertmhaas@xxxxxxxxx> 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

-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux