Re: [HACKERS] Clamping reulst row number of joins.

2015-03-09 Thread Kyotaro HORIGUCHI
Hello, thank you for the considerations by all of you, but I have described incorrectly the situation. I'm terribly sorry for the imprecise description and for your additional work based on it. The point of this issue is not VAULES but the nature of Append and NestLoop. Nested Loop can fail to ha

Re: [HACKERS] Clamping reulst row number of joins.

2015-03-08 Thread Tom Lane
I wrote: >> Stephen Frost writes: >>> I've certainly seen and used values() constructs in joins for a variety >>> of reasons and I do think it'd be worthwhile for the planner to know how >>> to pull up a VALUES construct. > I spent a bit of time looking at this, and realized that the blocker > is

Re: [HACKERS] Clamping reulst row number of joins.

2015-03-06 Thread Tom Lane
I wrote: > Hm, the problem evidently is that we get a default selectivity estimate > for the ON condition. I think a proper fix for this would involve > teaching eqjoinsel (and ideally other join selectivity functions) how > to drill down into appendrels and combine estimates for the child > relat

Re: [HACKERS] Clamping reulst row number of joins.

2015-03-06 Thread Tom Lane
Tom Lane writes: > Stephen Frost writes: >> * Tom Lane (t...@sss.pgh.pa.us) wrote: >>> BTW, is that JOIN (VALUES(...)) thing common in applications, or did you >>> just use it to make a compact example? If it were something worth >>> optimizing, it seems like we could teach the planner to "pull

Re: [HACKERS] Clamping reulst row number of joins.

2015-03-06 Thread Tom Lane
Stephen Frost writes: > * Tom Lane (t...@sss.pgh.pa.us) wrote: >> BTW, is that JOIN (VALUES(...)) thing common in applications, or did you >> just use it to make a compact example? If it were something worth >> optimizing, it seems like we could teach the planner to "pull up VALUES" >> in the sam

Re: [HACKERS] Clamping reulst row number of joins.

2015-03-06 Thread Stephen Frost
* Tom Lane (t...@sss.pgh.pa.us) wrote: > BTW, is that JOIN (VALUES(...)) thing common in applications, or did you > just use it to make a compact example? If it were something worth > optimizing, it seems like we could teach the planner to "pull up VALUES" > in the same way that it flattens sub-se

Re: [HACKERS] Clamping reulst row number of joins.

2015-03-06 Thread Tom Lane
Kyotaro HORIGUCHI writes: > Hello, I had a report that a query gets wired estimated row > numbers and it makes subsequent plans wrong. > Although the detailed explanation is shown later in this mail, > the problem here was that a query like following makes the path > with apparently wrong row num

[HACKERS] Clamping reulst row number of joins.

2015-03-06 Thread Kyotaro HORIGUCHI
Hello, I had a report that a query gets wired estimated row numbers and it makes subsequent plans wrong. Although the detailed explanation is shown later in this mail, the problem here was that a query like following makes the path with apparently wrong row number. EXPLAIN SELECT a FROM (SELECT a