Re: Costing elided SubqueryScans more nearly correctly

2022-07-19 Thread Tom Lane
Alvaro Herrera writes: > Thanks, pushed. Pushed the original patch now too. regards, tom lane

Re: Costing elided SubqueryScans more nearly correctly

2022-07-19 Thread Alvaro Herrera
On 2022-Jul-19, Richard Guo wrote: > On Tue, Jul 19, 2022 at 1:30 AM Tom Lane wrote: > > WFM. (I'd fixed the comment typo in my patch, but I don't mind if > > you get there first.) Ah, I see now you had other grammatical fixes and even more content there. > +1 The fix looks good to me. Thank

Re: Costing elided SubqueryScans more nearly correctly

2022-07-18 Thread Richard Guo
On Tue, Jul 19, 2022 at 1:30 AM Tom Lane wrote: > Alvaro Herrera writes: > > On 2022-Jul-18, Richard Guo wrote: > >> BTW, not related to this patch, the new lines for parallel_aware check > >> in setrefs.c are very wide. How about wrap them to keep consistent with > >> arounding codes? > > > Not

Re: Costing elided SubqueryScans more nearly correctly

2022-07-18 Thread Tom Lane
Alvaro Herrera writes: > On 2022-Jul-18, Richard Guo wrote: >> BTW, not related to this patch, the new lines for parallel_aware check >> in setrefs.c are very wide. How about wrap them to keep consistent with >> arounding codes? > Not untrue! Something like this, you mean? Fixed the nearby typo

Re: Costing elided SubqueryScans more nearly correctly

2022-07-18 Thread Alvaro Herrera
On 2022-Jul-18, Richard Guo wrote: > BTW, not related to this patch, the new lines for parallel_aware check > in setrefs.c are very wide. How about wrap them to keep consistent with > arounding codes? Not untrue! Something like this, you mean? Fixed the nearby typo while at it. -- Álvaro Herr

Re: Costing elided SubqueryScans more nearly correctly

2022-07-17 Thread Richard Guo
On Mon, Jul 18, 2022 at 3:16 AM Tom Lane wrote: > I wrote: > > I also notice that setrefs.c can elide Append and MergeAppend nodes > > too in some cases, but AFAICS costing of those node types doesn't > > take that into account. > > I took a closer look at this point and realized that in fact, >

Re: Costing elided SubqueryScans more nearly correctly

2022-07-17 Thread Tom Lane
I wrote: > I also notice that setrefs.c can elide Append and MergeAppend nodes > too in some cases, but AFAICS costing of those node types doesn't > take that into account. I took a closer look at this point and realized that in fact, create_append_path and create_merge_append_path do attempt to a

Re: Costing elided SubqueryScans more nearly correctly

2022-06-02 Thread Etsuro Fujita
On Thu, May 5, 2022 at 4:30 PM Richard Guo wrote: > On Thu, May 5, 2022 at 7:03 AM Tom Lane wrote: >> 1015 improvements to 14 disimprovements isn't a bad score. I'm >> a bit surprised there are that many removable SubqueryScans TBH; >> maybe that's an artifact of all the "SELECT *" queries. > T

Re: Costing elided SubqueryScans more nearly correctly

2022-05-05 Thread Richard Guo
On Thu, May 5, 2022 at 7:03 AM Tom Lane wrote: > I wrote: > > I instrumented the code in setrefs.c, and found that during the > > core regression tests this patch estimates correctly in 2103 > > places while guessing wrongly in 54, so that seems like a pretty > > good step forward. > > On second

Re: Costing elided SubqueryScans more nearly correctly

2022-05-04 Thread Tom Lane
I wrote: > I instrumented the code in setrefs.c, and found that during the > core regression tests this patch estimates correctly in 2103 > places while guessing wrongly in 54, so that seems like a pretty > good step forward. On second thought, that's not a terribly helpful summary. Breaking thin

Costing elided SubqueryScans more nearly correctly

2022-05-04 Thread Tom Lane
In [1] I complained about how SubqueryScans that get deleted from a plan tree by setrefs.c nonetheless contribute cost increments that might cause the planner to make odd choices. That turned out not to be the proximate cause of that particular issue, but it still seems like it might be a good ide