Re: [BUGS] Botched estimation in eqjoinsel_semi for cases without reliable ndistinct

2012-02-15 Thread Tom Lane
[ getting back to this after assorted distractions ] Andres Freund writes: > On Thursday, January 12, 2012 02:24:44 AM Tom Lane wrote: >> Andres Freund writes: >>> On Thursday, January 12, 2012 01:01:01 AM Tom Lane wrote: Looks pretty bogus to me. You're essentially assuming that the side

Re: [BUGS] Botched estimation in eqjoinsel_semi for cases without reliable ndistinct

2012-01-12 Thread Casey Allen Shobe
On Wed, 11 Jan 2012 19:40:34 -0500, Andres wrote: > Unfortunately the pastebins where raptelan provided plans expired by > now... Perhaps he can provide them again? Sure, the original curiosity I noticed was that adjusting the block size of results returned by the CTE had widely different effects,

Re: [BUGS] Botched estimation in eqjoinsel_semi for cases without reliable ndistinct

2012-01-11 Thread Andres Freund
On Thursday, January 12, 2012 02:24:44 AM Tom Lane wrote: > Andres Freund writes: > > On Thursday, January 12, 2012 01:01:01 AM Tom Lane wrote: > >> Looks pretty bogus to me. You're essentially assuming that the side of > >> the join without statistics is unique, which is a mighty dubious > >> as

Re: [BUGS] Botched estimation in eqjoinsel_semi for cases without reliable ndistinct

2012-01-11 Thread Tom Lane
Andres Freund writes: > On Thursday, January 12, 2012 01:01:01 AM Tom Lane wrote: >> Looks pretty bogus to me. You're essentially assuming that the side of >> the join without statistics is unique, which is a mighty dubious >> assumption. > It sure is a bit dubious. But assuming that a semijoi

Re: [BUGS] Botched estimation in eqjoinsel_semi for cases without reliable ndistinct

2012-01-11 Thread Andres Freund
On Thursday, January 12, 2012 01:01:01 AM Tom Lane wrote: > (In cases where we know it's unique, something like this > could be reasonable, but I believe get_variable_numdistinct already > accounts for such cases.) One of those case which looks relatively easy is that CTEs currently work as a kin

Re: [BUGS] Botched estimation in eqjoinsel_semi for cases without reliable ndistinct

2012-01-11 Thread Andres Freund
On Thursday, January 12, 2012 01:01:01 AM Tom Lane wrote: > Andres Freund writes: > Also, why the asymmetry in null handling? And why did you only touch > one of the two code paths in eqjoinsel_semi? They have both got this > issue of how to estimate with inadequate stats. This patch was purely

Re: [BUGS] Botched estimation in eqjoinsel_semi for cases without reliable ndistinct

2012-01-11 Thread Tom Lane
Andres Freund writes: > Whats your opinion on this? Looks pretty bogus to me. You're essentially assuming that the side of the join without statistics is unique, which is a mighty dubious assumption. (In cases where we *know* it's unique, something like this could be reasonable, but I believe g

[BUGS] Botched estimation in eqjoinsel_semi for cases without reliable ndistinct

2012-01-11 Thread Andres Freund
Hi all, Monday RhodiumToad/Andrew Gierth and I tried to debug a plan of raptelan (CCed) getting rather strange plans. After trawling through some unrelated stuff we diagnosed that the problem were some rather strange estimates. I managed to extract a reproducable, simple testcase. Our analysis