On Sat, 25 Mar 2023 at 14:40, David Rowley <dgrowleyml@gmail.com> wrote:
> I think what it would take would be to look at each WindowFunc and
> then estimate how many rows we need to look at for each WindowClause
> and then take the Max of that number of rows and calculate the
> proportion of the subpath's total cost we need to use based on the
> number of estimated rows from the subpath. I think the total subpath
> rows would need to be divided by the ndistinct estimate for the
> PARTITION BY clause too.
I've written patch to fix this and started a thread on -hackers [1] to
discuss it.
David
[1] https://postgr.es/m/CAApHDvrB0S5BMv+0-wTTqWFE-BJ0noWqTnDu9QQfjZ2VSpLv_g@mail.gmail.com