Re: Fix incorrect start up costs for WindowAgg paths (bug #17862)

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: David Rowley <dgrowleyml@gmail.com>, Andy Fan <zhihui.fan1213@gmail.com>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>, Tim Palmer <tim3sp@gmail.com>
Date: 2023-08-04T00:46:46Z
Lists: pgsql-hackers
Nathan Bossart <nathandbossart@gmail.com> writes:
> On Fri, Aug 04, 2023 at 09:28:51AM +1200, David Rowley wrote:
>> Thank you for reviewing.  I've pushed the patch to master only.

> I'm seeing some reliable test failures for 32-bit builds on cfbot [0].  At
> a glance, it looks like the relations are swapped in the plan.

Yeah, I got the same result in a 32-bit FreeBSD VM.  Probably, the two
plans are of effectively-identical estimated cost, and there's some
roundoff effect in those estimates that differs between machines with
4-byte and 8-byte MAXALIGN.

You could likely stabilize the plan choice by joining two tables that
aren't of identical size -- maybe add an additional WHERE constraint
on one of the tables?

			regards, tom lane



Commits

  1. Minor adjustments to WindowAgg startup cost code

  2. Account for startup rows when costing WindowAggs