Re: [PERFORM] Weird, bad 0.5% selectivity estimate for a column equal to itself

2013-06-26 Thread Josh Berkus
On 06/25/2013 06:41 PM, Tom Lane wrote: >> Well, it was more in the form of: >> tab1.x = COALESCE(tab2.y,tab1.x) > > Hm. I'm not following how you get from there to complaining about not > being smart about X = X, because that surely ain't the same. Actually, it was dominated by defaultsel, sinc

Re: [PERFORM] Weird, bad 0.5% selectivity estimate for a column equal to itself

2013-06-25 Thread Tom Lane
Josh Berkus writes: >> Personally, I'll bet lunch that that external software is outright >> broken, ie it probably thinks "X = X" is constant true and they found >> they could save two lines of code and a few machine cycles by emitting >> that rather than not emitting anything. > Well, it was mo

Re: [PERFORM] Weird, bad 0.5% selectivity estimate for a column equal to itself

2013-06-25 Thread Josh Berkus
> Personally, I'll bet lunch that that external software is outright > broken, ie it probably thinks "X = X" is constant true and they found > they could save two lines of code and a few machine cycles by emitting > that rather than not emitting anything. Of course, the amount of > parsing/planni

Re: [PERFORM] Weird, bad 0.5% selectivity estimate for a column equal to itself

2013-06-22 Thread Tom Lane
Josh Berkus writes: > On 06/21/2013 02:32 PM, Tom Lane wrote: >> See DEFAULT_EQ_SEL. > Why is it using that? We have statistics on the column. What reason > would it have for using a default estimate? The stats are generally consulted for "Var Op Constant" scenarios. It doesn't know what to

Re: [PERFORM] Weird, bad 0.5% selectivity estimate for a column equal to itself

2013-06-21 Thread Josh Berkus
On 06/21/2013 02:32 PM, Tom Lane wrote: > Josh Berkus writes: >> I'm getting something really odd in 9.2.4, where the planner estimates >> that the selectivity of a column equal to itself is always exactly 0.5% >> (i.e. 0.005X). I can't figure out where this constant is coming from, >> or why it'

Re: [PERFORM] Weird, bad 0.5% selectivity estimate for a column equal to itself

2013-06-21 Thread Tom Lane
Josh Berkus writes: > I'm getting something really odd in 9.2.4, where the planner estimates > that the selectivity of a column equal to itself is always exactly 0.5% > (i.e. 0.005X). I can't figure out where this constant is coming from, > or why it's being applied. See DEFAULT_EQ_SEL. But why