Re: BUG #16968: Planner does not recognize optimization

2021-05-17 Thread Eugen Konkov
Hello David, > I really think you're driving yourself down a difficult path by > expecting queries with whole-row vars to be optimised just as well as > using select * or explicitly listing the columns. Yes, I was expect that. I use whole-row because do not want repeat all 10+ columns at select.

Re: BUG #16968: Planner does not recognize optimization

2021-05-17 Thread Eugen Konkov
Hello David, Saturday, May 15, 2021, 5:52:47 PM, you wrote: > On Sun, 16 May 2021 at 02:34, Eugen Konkov wrote: >> I found a case when `not assigning a ressortgroupref to the whole-row var` >> cause >> wrong window function calculations. >> >> I use same query. The difference come when I

Re: BUG #16968: Planner does not recognize optimization

2021-05-17 Thread David Rowley
On Sat, 15 May 2021 at 00:39, KES wrote: > > Thank you for detailed explanation. I glad to hear that I can use aliases and > this will be recognized and optimization is applied. > > >We'd need some sort of ability to assign ressortgroupref to a particular > >column within a > whole-row var > Cou

Re: BUG #16968: Planner does not recognize optimization

2021-05-17 Thread David Rowley
On Sun, 16 May 2021 at 02:34, Eugen Konkov wrote: > I found a case when `not assigning a ressortgroupref to the whole-row var` > cause > wrong window function calculations. > > I use same query. The difference come when I wrap my query into > function. (see full queries in attachment) > >

Re: BUG #16968: Planner does not recognize optimization

2021-05-14 Thread KES
Thank you for detailed explanation. I glad to hear that I can use aliases and this will be recognized and optimization is applied. >We'd need some sort of ability to assign ressortgroupref to a particular column within awhole-row varCould it be possible to create hidden alias in same way as I did t

Re: BUG #16968: Planner does not recognize optimization

2021-05-14 Thread David Rowley
On Fri, 14 May 2021 at 02:38, Eugen Konkov wrote: > Now I create minimal reproducible test case. > https://dbfiddle.uk/?rdbms=postgres_13&fiddle=761a00fb599789d3db31b120851d6341 > > Optimization is not applyed when I filter/partition by column using composite > type name. You probably already kn