Re: Bad row estimation with indexed func returning bool

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jehan-Guillaume de Rorthais <jgdr(at)dalibo(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bad row estimation with indexed func returning bool
Date: 2015-09-24 22:38:08
Message-ID: 19561.1443134288@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
>> The implication of doing it like this would be that the default estimate
>> in the absence of any matching stats would be 0.5 (since eqsel defaults
>> to 1/ndistinct, and get_variable_numdistinct will report 2.0 for any
>> boolean-type expression it has no stats for). That's not a huge change
>> from the existing 0.3333333 estimate, which seems pretty unprincipled
>> anyway ... but it would probably be enough to annoy people if we did it in
>> stable branches. So I'd be inclined to propose changing this in HEAD and
>> maybe 9.5, but not further back. (For non-function expressions, 0.5 is
>> the default already, so those would not change behavior.)

> I experimented with the attached patch. The change in the default
> estimate for a function results in just one change in the standard
> regression test results, so far as I can find.

After more thought I concluded that changing the default behavior is
something not to do without a lot more testing than I have time for now.
So I modified the patch to preserve the old default estimate for
statistics-less function calls, and pushed it.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-09-24 22:40:28 Re: No Issue Tracker - Say it Ain't So!
Previous Message Alvaro Herrera 2015-09-24 22:30:47 Re: 9.3.9 and pg_multixact corruption